I'm trying to check to see if the current user is a member of a certain group, but my script keeps failing. Everything I can find shows that what I have should work, but it's failing on the GetObject().
I've verified that the GetObject string is being properly populated, but it still breaks at that point. I've tried various methods, all using GetObject, but they fail.
Any help is appreciated.
Code:
Function IsMember(groupName)
Set netObj = CreateObject("WScript.Network")
domain = netObj.UserDomain
user = netObj.UserName
flgIsMember = false
[highlight]Set userObj = GetObject("WinNT://" & domain & "/" & user & ",user")[/highlight]
For Each grp In userObj.Groups
If grp.Name = groupName Then
flgIsMember = true
Exit For
End If
Next
IsMember = flgIsMember
Set userObj = nothing
Set netObj = nothing
End Function
retCode = IsMember("GP Export Reports")
Response.Write retCode
I've verified that the GetObject string is being properly populated, but it still breaks at that point. I've tried various methods, all using GetObject, but they fail.
Any help is appreciated.