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 train...
VasilMichev
Jul 24, 2020MVP
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.
- pammndJul 24, 2020Brass 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 }