Forum Discussion

Tim_David's avatar
Tim_David
Copper Contributor
Feb 08, 2023

Adding a Teams group owner using Powershell

From the M365 Admin Centre I can add a user as an Owner of a Teams group without them being a member. When I try using Powershell I get an error

Only Members can be Owners of a group. Please add '********' first as members before adding them as owners.

Is there a way of doing it?

 

 

 

#Parameter
$GroupOwner = "****@**.***"

#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False

#Get All Office 365 Groups and Add Group Owner
Get-UnifiedGroup -ResultSize Unlimited | ForEach-Object {
Add-UnifiedGroupLinks -Identity $_.Name -LinkType Owners -Links $GroupOwner
Write-host "Added Owner to Group:"$_.DisplayName
}

#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

 

 

 

 

1 Reply

  • The M365 portal uses a different API, and the different teams within Microsoft have never been very good at talking to each other, thus you have the difference in behavior ๐Ÿ™‚

    Joking aside, I'm not sure if this is actually the expected behavior, let me ask around.

Resources