Forum Discussion
jcasqueiro
May 04, 2021Brass Contributor
O365 Report | Groups users belong to
Hi,
I need to generate an excel list with users and the corresponding groups they belong to like:
user1,group1,group2,group3
user2,group1,group4
....
How can I get this?
Thanks/Brgds
joao
- There are plenty such scripts available online, find the one that best suits your needs and modify it as needed. Here's one of mine: https://www.michev.info/Blog/Post/2250/generating-a-report-of-users-group-membership-memberof-inventory
- Here's another take on the topic: https://office365itpros.com/2021/02/23/microsoft-365-groups-membership-report/
- There are plenty such scripts available online, find the one that best suits your needs and modify it as needed. Here's one of mine: https://www.michev.info/Blog/Post/2250/generating-a-report-of-users-group-membership-memberof-inventory
- jcasqueiroBrass ContributorHi Vasil,
I got the following error:
PS C:\temp> .\GroupMembership
PowerShell credential request
Enter your credentials.
User: xxxxxxxxxxxxxxxxxxxxx
Password for user joao.casqueiro@cascais.onmicrosoft.com: ****************
WARNING: The names of some imported commands from the module 'tmp_ezdrmpwi.sjb' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
Get-Recipient: The operation couldn't be performed because object 'gosho' couldn't be found on 'VI1P193A001DC06.EURP193A001.PROD.OUTLOOK.COM'.
Write-Error: C:\temp\GroupMembership.ps1:124
Line |
124 | Get-DGMembershipInventory @PSBoundParameters -OutVariable global:varD …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No users of the specifyied types were found, specify different criteria.
PS C:\temp>
Can you help?
Thanks/Brgds
joao- Uh, that's on me, seems I forgot to clean up the script after doing some tests. You can remove "gosho" from line 78, or just redownload the updated script version.