List all Office Groups with the owners and members using Powershell

One of the cool things on Office 365 are the Office Groups. By default everyone can create an Office Group using the web interface, the apps or by using Outlook. You can disable this behavious via some PowerShell scripts that you can find here.

With those PowerShell commands you can do some other cool things like listing all the groups with their owners (or members).


# We need some credentials of course
$UserCredential = Get-Credential
# Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
# Import the session
Import-PSSession $Session
# Do Stuff...


foreach($group in $groups)
	Write-Host "************************************************"
	Write-Host "GroupName: "  $group.DisplayName
	$managerEmail=Get-Recipient -Identity $group.ManagedBy.Name | select PrimarySmtpAddress
	Write-Host "Managed by: "  $managerEmail
	Write-Host "--- Members ---"
	$membersOfGroup=Get-UnifiedGroupLinks -Identity $group.Identity -LinkType Members
	foreach($member in $membersOfGroup)
		Get-Recipient -Identity $member.Name | select PrimarySmtpAddress |Format-Wide 
# Kill the session
Remove-PSSession $Session

As you can see we loop all groups and we use the ManagedBy property. That is a list of users. The commandlet we used it hte Get-UnifiedGroupLinks and you can specifiy the LinkType parameters to select members or owners.