Link to home
Start Free TrialLog in
Avatar of ppmchgo
ppmchgo

asked on

Nested list of group membership for users

I need to list each group (recursively) that an individual AD user is a member of and have the data saved in a CSV file.

Ideally, it will have five columns; username, parent group, sub groups, group type, group scope.

I have found quite a few scripts that people have written, but they either give me the data onscreen and I can't figure out how to export to csv or they export to csv fine, but don't give me the data I need.  

Any help?
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Can you post a link (or the script) that you have that gives you the data you need, but prints to screen?

Dan
This is pretty easy. If you are only looking to find Groups where a specific user is part of use the following one-liner below...

Get-ADPrincipalGroupMembership -Identity user1 | Select Name, GroupScope, GroupCategory | Export-csv "c:\groups.csv" -nti

Open in new window


Thats it.

Will.
ASKER CERTIFIED SOLUTION
Avatar of ppmchgo
ppmchgo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ppmchgo
ppmchgo

ASKER

I was not able to solve the problem I was having.  I ended up coming up with a different solution that satisfied what I was looking for.