| kmarks 2004-10-28, 5:51 pm |
| I am having an issue enumerating a given users groups with the following ASP
script:
Sub GetGroups()
Dim sDomain
sDomain = "bsd-dean"
UserGroups = ""
if instr(1,Request.ServerVariables("LOGON_USER"),"\") > 0 then
sUser = replace(Request.ServerVariables("LOGON_USER"),"\","/")
else
sUser = sDomain & "/" & Request.ServerVariables("LOGON_USER")
end if
Set oUser = GetObject("WinNT://" & sUser)
For Each oGroup In oUser.Groups
if UserGroups <> "" then UserGroups = UserGroups & "," end if
UserGroups = UserGroups & oGroup.Name
Next
Response.Write UserGroups
Response.Write "<br>"
'Response.Write oUser.get("name")
if UserGroups<>"" then UserGroups=split(UserGroups,",")
set oUser = Nothing
set oGroup = Nothing
end sub
The script works fine on my 2000 server machine and also works for the
administrator on the 2003 machine. I get the user logon info including the
domain, but I get an access denied error when it tries to read the groups
that the users are in. Anybody know how to get this to work?
|