Listing02_Enum_Users (VBScript)

This code can be found in Chapter 5 of Managing Enterprise Active Directory Services

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4

On Error Resume Next
Dim wmi_path
wmi_path = "winmgmts:root/directory/LDAP"
Set users = GetObject(wmi_path).InstancesOf("ds_user")
If Err = 0 Then
   for each user in users
      WScript.Echo user.ds_samaccountname
   next
Else
   WScript.Echo ErrNumber, Err.Source, Err.Description
End If

This code has been viewed 1105 times.

New from the creators of TechTasks.com: StatSheet.com