I have a logon script that maps drives based upon group membership. When logging into the domain server the script runs and applies the mappings just fine. However when the script is run on the client machine nothing happens. No error messages etc.
I have run net use Z: \\Server\Share from the command line on the client machine and it maps just fine. I have checked all the GPO options and everything looks just the way it should according to documentation etc.
Any Ideas? .vbs Code posted below.
Thanks in advance.
Const Administration = "cn=Administration"
Const Center_Manager = "cn=Center_Manager"
Const Clinic_Staff = "cn=Clinic_Staff"
Const Clinician = "cn=Clinician"
Const Development = "cn=Development"
Const Education = "cn=Education"
Const Facilities = "Cn=Facilities"
Const Finance = "cn=Finance"
Const HR = "cn=HR"
Const Reception = "cn=Reception"
Const Admin = "cn=domain admins"
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
Wscript.Echo strGroups
If instr(strGroups, Admin) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "N:", "\\Server\Development"
wshNetwork.MapNetworkDrive "O:", "\\Server\Facilities"
wshNetwork.MapNetworkDrive "P:", "\\Server\Administrators"
ElseIf InStr(strGroups, Administration) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
ElseIf InStr(strGroups, Center_Manager) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
ElseIf inStr(strGroups, Clinic_Staff) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
ElseIf instr(strGroups, Clinician) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
ElseIf instr(strGroups, Development) Then
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "N:", "\\Server\Development"
ElseIf instr(strGroups, Education) Then
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
ElseIf instr(strGroups, Facilities) Then
wshNetwork.MapNetworkDrive "O:", "\\Server\Facilities"
ElseIf instr(strGroups, Finance) Then
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
ElseIf instr(strGroups, HR) Then
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
End If
I have run net use Z: \\Server\Share from the command line on the client machine and it maps just fine. I have checked all the GPO options and everything looks just the way it should according to documentation etc.
Any Ideas? .vbs Code posted below.
Thanks in advance.
Const Administration = "cn=Administration"
Const Center_Manager = "cn=Center_Manager"
Const Clinic_Staff = "cn=Clinic_Staff"
Const Clinician = "cn=Clinician"
Const Development = "cn=Development"
Const Education = "cn=Education"
Const Facilities = "Cn=Facilities"
Const Finance = "cn=Finance"
Const HR = "cn=HR"
Const Reception = "cn=Reception"
Const Admin = "cn=domain admins"
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
Wscript.Echo strGroups
If instr(strGroups, Admin) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "N:", "\\Server\Development"
wshNetwork.MapNetworkDrive "O:", "\\Server\Facilities"
wshNetwork.MapNetworkDrive "P:", "\\Server\Administrators"
ElseIf InStr(strGroups, Administration) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
ElseIf InStr(strGroups, Center_Manager) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
ElseIf inStr(strGroups, Clinic_Staff) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
ElseIf instr(strGroups, Clinician) Then
wshNetwork.MapNetworkDrive "F:", "\\Server\Pt_Services"
wshNetwork.MapNetworkDrive "G:", "\\Server\Clinicians"
ElseIf instr(strGroups, Development) Then
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "N:", "\\Server\Development"
ElseIf instr(strGroups, Education) Then
wshNetwork.MapNetworkDrive "I:", "\\Server\Marketing_PA"
wshNetwork.MapNetworkDrive "J:", "\\Server\Volunteers"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "H:", "\\Server\Education"
ElseIf instr(strGroups, Facilities) Then
wshNetwork.MapNetworkDrive "O:", "\\Server\Facilities"
ElseIf instr(strGroups, Finance) Then
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
ElseIf instr(strGroups, HR) Then
wshNetwork.MapNetworkDrive "L:", "\\Server\Finance"
wshNetwork.MapNetworkDrive "M:", "\\Server\Grants"
wshNetwork.MapNetworkDrive "K:", "\\Server\HR"
End If