In the last post of the Office 365 Groups for Admins series I showed you how to manage the Unified Groups using PowerShell. Let’s continue on that journey and take a look at how you can manage the Group memberships using PowerShell.
All membership management are done using the *-UnifiedGroupLinks cmdlets, you can access them using PowerShell and connecting to Exchange Online as shown in the previous post. The cmdlets is at the moment that well documented. If that changes I’ll make sure to update this post (and please remind me).
Public vs Private Groups
Before we dive into Memberships let’s take a look at Public vs Private Groups, something you configure when creating the Group. In Public Groups anyone within your Organization can participate in discussions and access its content, whereas in Private Groups you have to be a member.
Listing members of Groups
First of all assume that we want to list the members of a Group. There are three types of Memberships in Office 365 Groups:
To show all the Members of a Group issue the following command:
Get-UnifiedGroupLinks -Identity "XT1000 Marketing" -LinkType "Members"
The LinkType parameter can be either Members, Owners or Subscribers.
Adding members to a Group
To add one or more accounts as a Member to a Group you use the Add-UnifiedGroupLinks cmdlet as follows:
Add-UnifiedGroupLinks ` -Identity "XT1000 Marketing" ` -LinkType "Members" ` -Links @("email@example.com","firstname.lastname@example.org")
Identity is the Group, LinkType has to be either Members, Owners or Subscribers and Links should be a single or an array of mailboxes.
To add a new admin to the Group, you use the LinkType set to Owners. But, before issuing that command you need to make the user a Member of the Group, so it is a two-stage rocket like this to make someone an admin:
Add-UnifiedGroupLinks ` -Identity "XT1000 Marketing" ` -LinkType "Members" ` -Links "email@example.com" Add-UnifiedGroupLinks ` -Identity "XT1000 Marketing" ` -LinkType "Owners" ` -Links "firstname.lastname@example.org"
Subscribers are basically just members but they have decided to Subscribe to events from the Group. They are added just like Owners - first a Member Group Link and then a Subscriber Group Link.
Note that the user creating the Group, using PowerShell, will always be an Owner (and Member).
Removing members from Groups
Removing users from a Group are very similar to adding them. If they are Owners or Subscribers that Group Link has to be removed first, then the Member Group Link:
Remove-UnifiedGroupLinks ` -Identity "XT1000 Marketing" ` -LinkType "Owners" ` -Links @("email@example.com") ` -Confirm:$false Remove-UnifiedGroupLinks ` -Identity "XT1000 Marketing" ` -LinkType "Members" ` -Links @("firstname.lastname@example.org") ` -Confirm:$false
This post showed with a few examples on how to manage memberships in Office 365 Groups, using PowerShell and the *-UnifiedGroupLinks cmdlets. In the upcoming posts we’ll take a look at how to combine the different cmdlets to produce some good reports of the Unified Groups.