Hi all,
I am writing a script to check if a users is a member of a group recursivly.
i am trying to pick up which groups are in a group so i can find out if my user in linked to any of these groups but isMember() only seems to return users?
has anyone done any recursive group checking?
e.g. of what i am tring to do.
Q. is Harper a member of gISUsers?
A. should be yes
Harperg is member of gISLRSD
gISStaff is member of gISLRSD
gISLRSD is member of gISUsers
my function so far
Function gMembers(groupName)
on error resume next
Set o = GetObject("WinNT:")
Set objgrp = penDSObject("WinNT://domain/"& groupName & ",group", "domain\user" , "password", 1)
if objgrp.adsPath = "" then
flgIsMember = "Group does not exsist!"
else
Set grp = GetObject("WinNT://domain/" & groupName)
Set memberList = grp.Members
For Each m In memberList
Set member = m
Response.write member.Name & "(" & member.Class & ")<BR/>"
Next
grp.members.filter = Array("group")
For Each usr In grp.Members
Response.write usr.Name & "," & usr.Class & "<BR/>"
Next
Set grp = nothing
end if
Set objgrp = nothing
Set o = nothing
IsMemberOf = flgIsMember
End Function
I am writing a script to check if a users is a member of a group recursivly.
i am trying to pick up which groups are in a group so i can find out if my user in linked to any of these groups but isMember() only seems to return users?
has anyone done any recursive group checking?
e.g. of what i am tring to do.
Q. is Harper a member of gISUsers?
A. should be yes
Harperg is member of gISLRSD
gISStaff is member of gISLRSD
gISLRSD is member of gISUsers
my function so far
Function gMembers(groupName)
on error resume next
Set o = GetObject("WinNT:")
Set objgrp = penDSObject("WinNT://domain/"& groupName & ",group", "domain\user" , "password", 1)
if objgrp.adsPath = "" then
flgIsMember = "Group does not exsist!"
else
Set grp = GetObject("WinNT://domain/" & groupName)
Set memberList = grp.Members
For Each m In memberList
Set member = m
Response.write member.Name & "(" & member.Class & ")<BR/>"
Next
grp.members.filter = Array("group")
For Each usr In grp.Members
Response.write usr.Name & "," & usr.Class & "<BR/>"
Next
Set grp = nothing
end if
Set objgrp = nothing
Set o = nothing
IsMemberOf = flgIsMember
End Function