Jump to content

Recommended Posts

Posted

Does anyone know if it is possible to run an AD query that lists all users in the domain who are members of more than 1 global security group?

 

If so, do you have a suggestion in how that string might look like, or already have a similar string that you want to share? :p

Guest TheLibrarian
Posted

This is quick and dirty, but should do the job you want.

if exist countgroups.csv del countgroups.csv
for /f "tokens=1 delims=*" %%i in ('dsquery user -limit 2000 -samid *') do (
for /f "tokens=1 delims=*" %%j in ('dsget user %%i -memberof ^| find /c "CN"') do (
echo %%i,%%j >> countgroups.csv
)
)

 

Save it to a .bat file and execute it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...