Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get all AD group membership recursively (requires AD module)
function Get-GroupsRec {
$dn = (Get-ADUser $User).DistinguishedName
Get-ADGroup -LDAPFilter ("(member:1.2.840.113556.1.4.1941:={0})" -f $dn) | select -expand Name | sort Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment