WSH – List members in Active Directory

Introduction – Listing the members of the Users container

This script enumerates all the Administrators in the Builin container.  If you like to learn by changing items in the code, well here is a challenge for you, adapt my script to list members of your OU.

WSH Topics



  1. Copy the entire Script in the green box below.
  2. Paste it into notepad.exe.
  3. File (menu), Save as AdminList.vbs.   Note: This is where people go wrong, remember the .vbs extension.
  4. Double click AdminList.vbs


‘Script to List all the Administrators in the Builtin container
‘Script created by Guy Thomas
‘Feel free to adapt names

Set objGroup = GetObject _
("LDAP://cn=Administrators, cn=Builtin, dc=CP,dc=com")
For each objMember in objGroup.Members
Wscript.Echo objMember.Name


  1. Alter the cn=Administrators to the name of another group.  Note it must be the name of a real group.
  2. Alter the cn=Builtin to OU=yourou.  Note you use OU here not cn.  Its an organization unit not a container.

If you get an error message – check this page


Guy Recommends:  SolarWinds’ Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD’s attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive software, download a free trial of SAM (Server & Application Monitor)

See Also