C
CJM
I need to be able to determine if the user is a member of a given AD group.
I have a method of doing this, but it is not suitable for 64bit OS's, so I
need to find an alternative route. I actually think an alternative route
might actually be a better route.
I'm not an ADSI expert (frankly, I find it confusing) and I don't want to
learn any more - I just want to be able to do this one thing.
How do you guys go about achieving this?
I found one method that worked on my development machine but not on the
server:
Dim COURTHOUSE, WshNetwork, existingDrives, ADSysInfo, CurrentUser,
UserName, ComputerName
Dim strGroups, oGroup,x
Set WshNetwork = CreateObject("WScript.Network")
Set existingDrives = WshNetwork.EnumNetworkDrives
Set ADSysInfo = CreateObject("ADSystemInfo")
Response.Write ADSysInfo.UserName & "<BR><BR>"
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) <<== error
on server
UserName = LCase(wshNetwork.UserName)
ComputerName = LCase(WshNetwork.ComputerName)
Response.Write UserName & " " & ComputerName
Select Case VarType(CurrentUser.MemberOf)
Case 8
strGroups = LCase(CurrentUser.MemberOf)
Case 8204
strGroups = LCase(Join(CurrentUser.MemberOf))
End Select
Response.Write strGroups
Ok, it's not polished code, but it works locally. However it produces a
'80072020' on the stated line. It seems to be a permissions issue of some
sort, but I can't find a solution.
Any ideas?
Thanks in advance.
Chris
I have a method of doing this, but it is not suitable for 64bit OS's, so I
need to find an alternative route. I actually think an alternative route
might actually be a better route.
I'm not an ADSI expert (frankly, I find it confusing) and I don't want to
learn any more - I just want to be able to do this one thing.
How do you guys go about achieving this?
I found one method that worked on my development machine but not on the
server:
Dim COURTHOUSE, WshNetwork, existingDrives, ADSysInfo, CurrentUser,
UserName, ComputerName
Dim strGroups, oGroup,x
Set WshNetwork = CreateObject("WScript.Network")
Set existingDrives = WshNetwork.EnumNetworkDrives
Set ADSysInfo = CreateObject("ADSystemInfo")
Response.Write ADSysInfo.UserName & "<BR><BR>"
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) <<== error
on server
UserName = LCase(wshNetwork.UserName)
ComputerName = LCase(WshNetwork.ComputerName)
Response.Write UserName & " " & ComputerName
Select Case VarType(CurrentUser.MemberOf)
Case 8
strGroups = LCase(CurrentUser.MemberOf)
Case 8204
strGroups = LCase(Join(CurrentUser.MemberOf))
End Select
Response.Write strGroups
Ok, it's not polished code, but it works locally. However it produces a
'80072020' on the stated line. It seems to be a permissions issue of some
sort, but I can't find a solution.
Any ideas?
Thanks in advance.
Chris