September 20, 2015

Get-MsolGroupMember - Office 365 Group Membership (Extended)

This PowerShell script extends functionality of Get-MsolGroupMember cmdlet from Windows Azure Active Directory Module.
It adds GroupDisplayName, GroupEmail and GroupType to output for every group member. It allows to make a customized Office 365 group membership report and export data to CSV file. 
Included properties: GroupDisplayName, GroupEmail, GroupType, MemberDisplayName, MemberEmail, MemberType
Windows Azure Active Directory Module for PowerShell should be installed. Connection to Azure AD should be initialized before the script (Connect-MsolService).

Some use cases:
# Display in table Office 365 Group membership report
.\Get-MsolGroupMember.ps1 | ft -Wrap
# Show groups where email is a member of, export results to csv file
.\Get-MsolGroupMember.ps1 | where {$_.MemberEmail -eq ""} | export-csv file.csv
# Show only security groups
.\Get-MsolGroupMember.ps1 | where {$_.GroupType -eq "Security"} | ft -Wrap

No comments:

Post a Comment