Logon scripts for Windows 2003
Posted on 2004-09-17
Hello.. I am using logon scripts for the first time.
My AD has some Global Groups under USERS which include the groups "Technical", and "Staff". These groups have access to different folders which I want mapping automatically on login. I have created and shared the fodlers with appropriate permissions / security and tested them.. all ok.
I now want a script that looks at the person logging on, maps them a home drive (this bit works), and then finds out if they are a member of a certain group (you CAN belong to more than one) and give them the appropriate mapping..
I can successfully map a drive WITHOUT a check, thats easy enough..
Here is the script thus far
Const STAFF = "CN=Staff"
Const TECHNICAL = "CN=Technical"
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "H:", "\\server001\Profiles\" & wshNetwork.UserName & "\Documents"
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
If InStr(strGroups, TECHNICAL) Then
wshNetwork.MapNetworkDrive "S:", "\\server001\Software\"
ElseIf InStr(strGroups, STAFF) Then
wshNetwork.MapNetworkDrive "I:", "\\Server\Business\"
It does not error at all, maps the H drive OK, just does not map the other drive(s).. I have logged on as a usre in the TECHNICAL group for this..
any help appreciated