Script to query all users in the domain and find out which Global Groups they belong to

Script to query all users in the domain and find out which Global Groups they belong to or query all users and find out if the belong to any of the groups in a specific OU.
scfcuAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
SubsunConnect With a Mentor Commented:
If you have windows 2008 R2 Domain controller or above then you can try...
Import-Module Activedirectory
Get-ADUser -Filter * -Properties DisplayName,memberof | % {
 $Name = $_.DisplayName
 $_.memberof | Get-ADGroup | ?{$_.GroupScope -eq "Global"} | Select @{N="User";E={$Name}},Name
} | Export-Csv C:\temp\report.csv -nti

Open in new window

0
All Courses

From novice to tech pro — start learning today.