Note: Before proceed, Connect Exchange Online Remote PowerShell.
The following command lists all the office 365 groups.
Get-UnifiedGroup -ResultSize Unlimited | Select DisplayName,GroupType,PrimarySmtpAddress
List Office 365 Group Members
We can use the powershell cmdlet Get-UnifiedGroupLinks to view the members of an existing group. The key parameters for this cmdlet are:
Identity – the alias of the group
LinkType – Members, Owners, or Subscribers. Required.
Use the below powershell command to select members of a single office 365 group.
Get-UnifiedGroupLinks -Identity '<group-name>' -LinkType Members -ResultSize Unlimited
If you want to list members of all the office 365 groups, first, we need to get the results of Get-UnifiedGroup, then we can pipe the output to ForEach-Object and get members for all the office 365 groups.
Export All Office 365 Group Members to CSV
We can export powershell output into CSV file using Export-CSV cmdlet. The following command exports all the office 365 group members to CSV file.
$Groups = Get-UnifiedGroup -ResultSize Unlimited $Groups | ForEach-Object { $group = $_ Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object { New-Object -TypeName PSObject -Property @{ Group = $group.DisplayName Member = $_.Name EmailAddress = $_.PrimarySMTPAddress RecipientType= $_.RecipientType }}} | Export-CSV "C:\Office365GroupMembers.csv" -NoTypeInformation -Encoding UTF8
CSV output of O365 Groups and Members
hi
it works with me but there is a small problem
i didn't get all the groups i got some of them only
can u solve it
can you please post commands that used and error details if you got anything?
Hi there! How do I get the date of association for each member with each group?
do you mean the date when a member was added to group?
This worked for me. I needed the owners of the group so i just changed -LinkType Members to -LinkType owners. Thanks!