PtboGiser
asked on
Quick way to Audit AD OU for users that are a members of a specified group
I have an OU containing a couple hundred users that are all to be removed from the default 'Domain Users' group upon account creation and placed in a custom primary group. Occasionally another staff may forget to do this, so I'd like a quick an easy way to audit that OU and discover any users in it that are still memebers of Domain Users.
I have this where the search base is the OU in question:
Get-ADUser -filter {memberof -recursivematch "CN=Domain Users,OU=Users,DC=<domain> ,DC=<domai n>"} -SearchBase "OU=<ou>,OU=<ou>,OU=<ou>,D C=<domain> ,DC=<domai n>"
But it returns no results, even if there are users in the specified OU that are members of Domain Users.
Can somone correct my powershell script? Or maybe advise a way I can do this from the Active Directory Users and Computers GUI? Thanks!
I have this where the search base is the OU in question:
Get-ADUser -filter {memberof -recursivematch "CN=Domain Users,OU=Users,DC=<domain>
But it returns no results, even if there are users in the specified OU that are members of Domain Users.
Can somone correct my powershell script? Or maybe advise a way I can do this from the Active Directory Users and Computers GUI? Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad we were able to help out.
Thanks
Mike
Thanks
Mike
ASKER
-See my final comment for the final Powershell commands I used
Which will list the user memberof the domain users group.