MSFN Forum: vbScript or batch script to find AD groups with two members or less - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

vbScript or batch script to find AD groups with two members or less Rate Topic: -----

#1 User is offline   tguy 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 698
  • Joined: 19-May 04

Posted 08 October 2011 - 07:22 AM

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.


#2 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,737
  • Joined: 13-January 06

Posted 08 October 2011 - 08:47 AM

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.

This post has been edited by allen2: 08 October 2011 - 08:47 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy