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 infor 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?

Re: Enumerating Groups in ASP with IIS 6.0 by krmarks76

krmarks76
Tue Nov 09 09:28:50 CST 2004

I did get this script to work when I changed authentication to clear
text in IIS 6.0, but it won't work with Integrated Windows
Authentication. Does anybody know anything about this??

krmarks76@hotmail.com (Ken Marks) wrote in message news:<61c77035.0411021406.678d445a@posting.google.com>...
> 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 infor 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?