PowerShell script to get the AD Group members List

To get the list of AD groups for the user account
Get-ADPrincipalGroupMembership user1 | select name | Export-csv -path C:\grouplist.csv

To get the list of Members in the AD Group in CSV file
Get-ADGroupMember -identity "Domain Admins" | Export-csv -path C:\userlist.csv

To get the list of Members in the AD Group in PowerShell
Get-ADGroupMember -identity "Domain Admins" | select name,samaccountname,distinguishedname

Comments