Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get all AD group membership recursively (requires AD module)
function Get-GroupsRec {
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[string]$User
)
$dn = (Get-ADUser $User).DistinguishedName
Get-ADGroup -LDAPFilter ("(member:1.2.840.113556.1.4.1941:={0})" -f $dn) | select -expand Name | sort Name
}
#https://stackoverflow.com/questions/23552094/how-to-get-all-ad-user-groups-recursively-with-powershell-or-other-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment