Thursday, 22 December 2016

Add or Remove Members and Owners in Office 365 Group using Powershell

We can use the Add-UnifiedGroupLinks cmdlet to add members and owners to an Office 365 Group and remove members and owners from unified group using the Remove-UnifiedGroupLinks cmdlet. Both the cmdlets includes the following key parameters:

Identity – Alias, Display name, or Email address of the group
Links – Alias, Display name, or Email address of the user being added
LinkType – Members, Owners, or Subscribers

Before proceed, run the following commands to connect Exchange Online Powershell session.
$365Logon = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $365Logon -Authentication Basic -AllowRedirection
Import-PSSession $Session

Add Members and Owners to Office 365 Group

This example add the member to the Office 365 Group named TestO365Group. We need to set the parameter LinkType as Members to add users as member.
Add-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members  –Links
The parameter Links accept multiple values, use the following syntax: value1,value2.... to add multiple members. If the values contain spaces or otherwise require quotation marks, use the following syntax: "value1","value2",....
Add multiple users as member:
Add-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members  –Links,
Add an user as owner: To add an user as a owner to office 365 group, first we need to add the user as a member to the specified group and then we have to add the user as owner.
Add-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members –Links
Add-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Owners –Links

Remove Members or Owners from Office 365 Group

This example removes the member and from the Office 365 Group named TestO365Group..
Remove-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members –Links , -Confirm:$false
Remove owner: To remove an owner from the group, first you have to remove user from the LinkType Owners and remove the user from the LinkType Members.
Remove-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Owners –Links -Confirm:$false
Remove-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members –Links -Confirm:$false

Add or Remove members from a CSV File:

You can use the below powershell commands to add members to an office 365 group by importing users from csv file. Consider the csv file members.csv that includes the column member which holds the member identity in each row of the csv file.
Import-CSV "C:\members.csv" | ForEach-Object {
Add-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members  –Links $_.member

List members or owners of a group

Once we added or removed members or owners, we can use the Get-UnifiedGroupLinks cmdlet to get members or owners of a specific group. The below command lists all members of the given group.
Get-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Members
List owners of a group.
Get-UnifiedGroupLinks –Identity "TestO365Group" –LinkType Owners



  1. Morgan, excellent page! Question, how do you use this to add "mail contacts" that are already in your exchange contacts. I cannot seem to make it work.

    1. Sorry Add-UnifiedGroupLinks do not support to add mail contacts. You can refer this great post "" to know more about "Office 365 Groups Support Mail Contacts as Guest Members"

  2. Good article once aցain. I am ⅼooking forward for уоur next post:)