Getting Users and Nested Users in AD Groups, and to display how I need – Tree

So my company is doing an Audit on admins across the 5 domains that we have, there are about 70 or so groups that I need to pull users from across all 5 of the domains every week.

So I wrote a powershell script that pulls the users in no problem using -recursive etc.

While this is not an issue, the external auditing company wants to know where the users reside.

The canonical name is not what they are looking for.

So for example

If there is a folder called Administrators, and there are users and groups in this folder, and one of the groups in that folder is Enterprise Administrators The auditor wants to see

Username – AdministratorsEnterprise Administrators

This can go on if there is a group in Enterprise Administrators called PoP Team And a user resides in there they want to see

Username AdministratorsEnterprise AdministratorsPop Team

This is all well over my head with powershell, every time I try to isolate the groups within the group it will pull users but not give me the folder path that the loop is following.

submitted by /u/Sh-t_Shower_Shave
[link] [comments]

Leave a Reply