How to get ALL AD user groups (recursively) with Powershell or other tools?

前端 未结 2 1854
野的像风
野的像风 2020-12-31 23:47

I\'m trying to get ALL the groups a user is member, even the nested ones (recusively), in Powershell I\'m using:

(Get-ADUser  -Properties Mem         


        
2条回答
  •  盖世英雄少女心
    2021-01-01 00:34

    Or, you can use the constructed attribute tokenGroups and a base-scoped query:

    $tokenGroups = Get-ADUser -SearchScope Base -SearchBase '' `
    -LDAPFilter '(objectClass=user)' -Properties tokenGroups | Select-Object `
    -ExpandProperty tokenGroups | Select-Object -ExpandProperty Value
    

提交回复
热议问题