strComputer = "atl-fs-01"
strTestString = "/" & strComputer & "/"
Set colGroups = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser In colGroups.Members
If InStr(objUser.AdsPath, strTestString) Then
Wscript.Echo "Local user: " & objUser.Name
ElseIf
objuser.name and objuser.class = User Then
Wscript.echo “I am a user”
Else
Wscript.Echo "I am a group " & objUser.Name
End If
End If
Next
The Class property method of the member object reveals whether the member is
a group, computer, or user. This is true for the WinNT and LDAP providers.
All local and AD objects have a Class method. This is not the same as the
objectClass attribute of AD objects, which is multi-valued.
For group objects:
The objectClass attribute has the values: top, group
The Class property method returns "group"
For user objects:
The objectClass attribute has the values: top, person,
organizationalPerson, user
The Class property method returns "user"
For computer objects:
The objectClass attribute has the values: top, person,
organizationalPerson, user, computer
The Class property method returns "computer"
For Active Directory users:
======
Set objUser = GetObject("LDAP://cn=Jim Smith,ou=Sales,dc=MyDomain,dc=com")
Wscript.Echo "Class: " & objUser.Class
Set objUser = GetObject("WinNT://MyDomian/JSmith,user")
Wscript.Echo "Class: " & objUser.Class
======
In both cases, using LDAP or WinNT, the class is "user" (or "User").
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--