Forum Discussion

jcasqueiro's avatar
jcasqueiro
Brass Contributor
May 04, 2021

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

    • jcasqueiro's avatar
      jcasqueiro
      Brass Contributor
      Hi 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
      • VasilMichev's avatar
        VasilMichev
        MVP
        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.

Resources