Forum Discussion
pammnd
Jul 24, 2020Brass Contributor
New teams I create as an admin but not owner show up as my teams
I'm a global admin in my organization and we've turned off our users' ability to create teams. (We noticed that too many teams were being created for things like one on one conversations and training wasn't help)... To create a team, I use a script in Powershell that allows me to do it in less than 2 minutes, but I've noticed that each team I create end up in my own Teams pane in the web and desktop clients, even if I'm not an owner or member of the team. I create at least a team a week, so it's a bit frustrating to have this many teams in my Teams pane.
I can't clear them out. When I try to access the teams' general channel, they disappear, but then come back after a few minutes. Has anyone experienced this? Am I creating the teams incorrectly? I added a screenshot of the Teams pane for reference.
Thank you!
A team needs an owner, if you don't specify one via the -Owner switch when running New-Team, the person running the cmdlet will be added as owner.
- pammndBrass Contributor
VasilMichev Thank you for the response, but I require that 2 owners be designated for every team I create. Example of the script is below
# Enter team info here: $DisplayName = 'TST - Test 7' $Description = 'Test teams capabilities - 7.' $MailNickName = 'tm-tst-test_7' $Owner1 = 'test.user@company.com' $Owner2 = 'test.user5@company.com' $Visibility = 'Private' # Enter team members here: $Members = 'test.user1@company.com','test.user2@company.com','test.user3@company.com','test.user4@company.com','test.user13@company.com' -split ',' # Team is created here: $newTeam = New-Team -DisplayName $DisplayName -Description $Description -Visibility $Visibility -MailNickName $MailNickName -Owner $Owner1 Add-TeamUser -GroupId $newTeam.groupID -User $Owner2 -Role Owner # Members are added here: foreach($member in $Members){ Add-TeamUser -GroupId $newTeam.GroupId -User $member -Role Member } # Confirm team is created here: $TeamCreated = $(try {Get-Team -GroupId $newTeam.GroupId} catch {$Null}) If ($TeamCreated -ne $Null) { Write-Host $DisplayName 'team has been created.' -ForegroundColor Cyan Get-Team -DisplayName $newTeam.DisplayName | Select DisplayName, Description, mailNickname Get-TeamUser -GroupId $newTeam.GroupId | ft } else { Write-Host 'Womp, Womp... Error. $DisplayName was not created.' -ForegroundColor Red }