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:

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:

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:

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:

  • 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:

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: