Created
October 18, 2013 08:04
-
-
Save cchitsiang/7038075 to your computer and use it in GitHub Desktop.
Get Group Membership of Particular AD User
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ID = read-host "Enter the user's ID you wish to scan" | |
$FQDN = "cn=block_cloning,dc=yourdomain,dc=com" #full FQDN of the block_cloning group | |
Get-ADUser -Identity $ID -Properties memberOf | % {$_.memberOf} | % {Get-ADGroup $_ -Properties *} ` | |
| select name, mail, GroupCategory, GroupScope,@{Label="Block_Cloning";Expression={ | |
If ($_.MemberOf -contains $FQDN) | |
{ "Yes" | |
} | |
Else | |
{ "No" | |
}}} | Sort mail, name | Export-CSV c:\pathofexport.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment