a PowerShell command that will recursively pull up all the groups that a user is part of

I found a good powershell command that will specifically list all  security groups a member is part of.

For example  John is part of the groupA, GroupB, GroupC.   

I  however was trying to add the recursive command to this because I want it to drill down further and tell me something like

john is part of groupA, GroupB, GroupC, and Group A is part of GroupD, and GroupE, ect...

I thought the -recursive command might work but I tried adding it all over and everywhere I add it I get different errors such as a parameter cannot be found that matches parameter name 'recursive'

========================

PS C:\Windows\system32> Get-ADUser user.name -Properties MemberOf | Select -ExpandProperty memberof | Get-ADGroup -Properties name | Where { $_.GroupCategory -eq 'Security'} | Select -ExpandProperty Name

========================

awhile back I had some command which listed all the groups inside of other groups but excluded usernames and only did groups such as distributing group or security group, but for the life of me I cannot find that cmdlet or remember what it was.

Anyone know a simple cmdlet that does what I am asking in the general since?


  • Edited by wilder7bc 12 hours 42 minutes ago
May 20th, 2015 2:30pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics