How do I generate the list of AD group memberships for each user from a list of AD user accounts?

35 Views Asked by At

I am able to generate the list of AD groups with group type information for one user and output it to a file, like so: Import-Module ActiveDirectory $OutFile = "C:\Temp\Reports\ADUserGroups.csv" (Get-ADUser -Identity bobsmith04 -Properties MemberOf).MemberOf | Get-ADGroup | Select-Object Name, DistinguishedName, GroupCategory, GroupScope | Export-Csv -Path $OutFile -NoTypeInformation

I like the output of this simple coding example. How do I augment this script to provide similar output files for multiple user accounts in an input file? It seems that I cannot use -Identity $UserAccount.

0

There are 0 best solutions below