I would like to query a user whether he was part of the group, the issue here is.. it sometimes hard to identify whether it was part of it because he could be in many level of the group sub group.
Example if I wanted to check if user was in "All Sales Users". He could be in the subgroup of "All Sales Users" > "Sales US" > "Sales SJ" > "Prod A" > "Item B"
The issue is, there is many sub group which I had to open all to search for him. How do I know whether he was part of "All Sales Users"? Best if the query could show the hierarchy.
I tried PowerShell but it just show the memberof. Not sure how to help on this.
You could try LDAP with Powershell
{0}
is the nested group, it should be a Distinguished name{1}
is the user sAMAccountName you want (you could use any other user property than sAMAccountName within(sAMAccountName={1})
)A recursive Powershell implementation, assumes you have ActiveDirectory Powershell module installed. It will return Common Name for all groups user is member of, including nested so in your example all 5 groups will be returned.
And a second function to utilise the first one:
So if you paste the above 2 functions into your powershell window you can run
Which will return a list of groups user is a member of, including hierarchy: