
Checking NT Group Membership
Both my site http://wsh.glazier.co.nz/frame.htm (in the code section)
and Clarence's site http://cwashington.netreach.net have examples of this.
Something like this...
On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
' Get the user ID, loop fixes a bug in the network object
strUser = ""
While strUser = ""
strUser = WSHNetwork.UserName
Wend
' Use ADSI get get list of groups the user belongs to
adsPath = "WinNT://" & strDomain & "/" & strUser
set adsObj = GetObject(adsPath)
For Each Prop In adsobj.groups
Select Case Prop.Name
Case "Domain Admins"
Call Administrators()
Case "Group1"
Call Group1()
Case "Group2"
Call Group2()
'etc
End Select
It will require ADSI to be installed on each client.
Regards,
Ian
WSH FAQ http://wsh.glazier.co.nz/frame.htm
Collaborate Today http://collaborate.glazier.co.nz
Quote:
> We are currently looking to use WSH as our default login script language,
> instead of KIX32.
> A number of KIX scripts we currently have, check for whether a user is a
> member of a particular NT group, and then run a particular command, e.g
map
> a drive.
> What I would like to know is whether this is possible in WSH, and whether
an
> example script is available.
> Many thanks
> Scott Davies