Manage Office 365 Group Members and Owners with PowerShell

With PowerShell UnifiedGrouplinks cmdlet we can easily manage the Office 365 Group member- and ownerships. The UnifiedGroupLinks cmdlet is part of the Exchange Online PowerShell session. So before we can start adding Office 365 Group Members or change them to Owner we first need to connect to Exchange Online.

Connecting to Exchange Online

First we need to connect to Exchange Online, you can use this connector script or run the following code:

#Create credential object
$credObject = Get-Credential

#Import the Exchange Online ps session
$ExchOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $credObject -Authentication Basic -AllowRedirection
Import-PSSession $ExchOnlineSession

Or with the connector script that makes everything a lot easier:


List Office 365 Group Member or Owners

So first let’s start with an overview of the current Office 365 Group Member or Owners:

Get-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Members

This will return all members and owners of the Office 365 Group. A owners is also a member of the group. The see who are owners of the group we need to change the LinkType to Owner:

Get-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Owners

Adding Member and Owners to an Office 365 Group

You can’t add an Owner straight away to an Office 365 Group, first you will have to make it a member of the group and then you can change the role to owner. So we start with adding members to a Office 365 Group:

Add-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Members  –Links,
  • Identity : the Alias, Displayname or Email address of the Group
  • LinkType: can be Subscripbers, Members or Owners
  • Links: Alias, Displayname or Email addres of the users you want to add. (Multiple users can be added with a comma separation)

Adding a member to a Group takes a few seconds before it’s processed.

To make an user Owner we first add them as a member and then change the role to Owner:

Add-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Members –Links
Add-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Owners –Links

Removing Members or owners from an Office 365 Group

To remove an owner from a Office 365 Group we need first to change the role to member. So only member can really be removed from a Group:

Remove-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Owners –Links -Confirm:$false
Remove-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Members –Links -Confirm:$false

#To remove only a member
Remove-UnifiedGroupLinks –Identity "O365GroupName" –LinkType Members –Links -Confirm:$false


9 thoughts on “Manage Office 365 Group Members and Owners with PowerShell”

  1. and you have forget this

    Getting all O365 Groups as person is a member of

    Get-UnifiedGroup | Where-Object { (Get-UnifiedGroupLinks $_.Alias -LinkType Members | foreach {$_.Name}) -contains “User Name”}

    • $admin = “”
      $groups = Get-UnifiedGroup
      foreach($group in $groups){
      $name = $group.Name
      Add-UnifiedGroupLinks –Identity $name –LinkType Members –Links $admin
      Add-UnifiedGroupLinks –Identity $name –LinkType Owners –Links $admin


Leave a Comment