
Getting NT group membership with WSH
If you want a list of all the user groups for a given user then try this...
strUser = ""
While strUser = ""
strUser = WSHNetwork.UserName
Wend
strDomain = "Your domain name" '**** change this ****
adsPath = "WinNT://" & strDomain & "/" & strUser
set adsObj = GetObject(adsPath)
For Each Prop In adsobj.groups
sMsg = sMsg & Prop.Name & strLF
Next
WshShell.Popup "You have been logged onto " & strDomain & strLf &_
"with the following permissions:" & strLf &_
sMsg, , "Logon Completed", 64
This code is in the sample logon script code found on the WSH FAQ WEB site
http://wsh.glazier.co.nz/frame.htm
Regards,
Ian
Quote:
>You have to use ADSI. I have an ADSI FAQ at my site. It includes several
>examples on how to use ADSI with WSH.... check it out.
>http://cwashington.netreach.net
>Its in the script repository. Now for the code...
>Set Group = GetObject("WinNT://Your_Domain/Your_Group", group)
>If Group.IsMember("WinNT://Your_Domain/username") = true then
> 'map a drive or something
>Else
> 'do something else here
>End if
>Clarence
>>Is there a way to return which group or groups a NT user belongs to
>>using WSH on Windows 95/98?