Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with user/group

Status
Not open for further replies.

mharcourt

Programmer
Apr 9, 2003
49
0
0
US
Using script snippit below I need a way to determine if the grp parameter is a user or a group.

Does anyone have a suggestion?
Thanks


Sub EnumGroupMembers(server,grp)

Dim Group
Dim Member

On Error Resume Next

'Bind to a group object.
Set Group = GetObject("WinNT://"+server+"/"+grp)
If Err <> 0 Then call check_error("Error in getting group members"):On Error goto 0 :Exit Sub

'Enumerate the members in group.
For Each Member in Group.Members
wsh.echo Left(server+Space(20),20)+Space(6)+Left(grp&Space(15),15)&Space(11)&Member.Name
UserClassPermDeleteListFile.WriteLine Left(server+Space(20),20)+Space(6)+Left(grp&Space(15),15)&Space(11)&Member.Name
Next

End Sub
 
Hello mharcourt,

Try check the schema class of it.
Code:
Set Group = GetObject("WinNT://"+server+"/"+grp)
If Err <> 0 Then call check_error("Error in getting group members"):On Error goto 0 :Exit Sub 
if strcomp(Group.class, "group",1)=0 then
    'enumerating members
else
    'something else
end if
regards - tsuji
 
mharcourt,

It's a supported vbscript function. If you meet, for whatever reason/platform to use it, use instead simple compare:
Code:
    if lcase(Group.class)="group" then
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top