Jump to content

vbScript or batch script to find AD groups with two members or less


Recommended Posts

I am looking for help writing a vbScript or batch file that will use something like ADO, ADSystemInfo or dsquery and dsget to bind to my domain and enumerate a list of all groups in the domain with two or less members in the group. Once the list of groups is obtained I would like to write the results to a text file showing:

1) Group Name and FQDN

2) Group Members

3) Date Created

We are in the process of cleaning up our Active Directory with old, unused or obsolete objects and this is part of that effort.

Thanks in advance for your help.

Link to comment
Share on other sites


I'd export all groups (of course as i don't know you ad structure, it could be the worst approach if your ad contains a lot of groups) with adfind or a dsquery and their members, then count each the number of members in each groups.

But perhaps it might be doable with as single dsquery -filter and the right ldap request.

Edited by allen2
Link to comment
Share on other sites

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...