Lists all the inetOrgPerson accounts in an ADAM OU named Accounting.

Visual Basic
Edit|Remove
On Error Resume Next

Set objOU = GetObject("LDAP://localhost:389/ou=Accounting,dc=fabrikam,dc=com")
objOU.Filter = Array("inetOrgPerson")

For Each objUser in objOU
    Wscript.Echo objUser.Name
Next