SherTeks
June 2nd, 2008, 06:04 AM
I am using the following script to echo all members except 'Administrator'
in 'Administrators' group :
strComputer = "XYZCOMPUTER"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" Then
Wscript.Echo objUser.Name
End If
Next
In a list of Administrators (In XP, accessible through Right click 'My
Computer' -> Manage -> Local Users and Groups -> Groups ->
Administrators (double click)), I've few entries like :
Administrator
user1
user2
xyzdom\user3
user3
user4
The above script echoes user3 twice.
I don't want the script to echo 'user3' for the entry xyzdom\user3.
How could the condition be specified/modified in the script ?
Thanks in advance.
in 'Administrators' group :
strComputer = "XYZCOMPUTER"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" Then
Wscript.Echo objUser.Name
End If
Next
In a list of Administrators (In XP, accessible through Right click 'My
Computer' -> Manage -> Local Users and Groups -> Groups ->
Administrators (double click)), I've few entries like :
Administrator
user1
user2
xyzdom\user3
user3
user4
The above script echoes user3 twice.
I don't want the script to echo 'user3' for the entry xyzdom\user3.
How could the condition be specified/modified in the script ?
Thanks in advance.