Hello, this document explains to you how to export office365 group members by using powershell -bad luck this is the my first post on my blog also this document contains windows service :))) –
Anyway! Good luck :))
For beginners note that you have to change file path with yours! “C:\Users\Admin\Desktop”
First, run powershell as an administrator
If this is the first command on your powershell you have to run this commands
Run below commands,
"$UserCredential = Get-Credential" It asks your office365 administrator crediantals
"$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
"Get-Group | select displayname,WindowsEmailAddress,Members,Identity,Name,Id | export-csv C:\Users\Admin\Desktop\Group4.csv -encoding unicode -append"
If you wanna export a mailgroup member you just run this command instead of step 4
"Get-DistributionGroupMember [email protected] | select displayname,primarysmtpaddress | export-csv C:\Users\Admin\Desktop\Group5.csv -encoding utf8 -append"
That’s it! Your group list exported on your desktop.