User1 is a member of Group2 and Group4 and needs both the i: drive and p: drive. When the logon scrip runs the i: drive maps and none of the drives after that map. Now, I realize that I am using an If statement and from what I know once one of the conditions is met the statement stops. I need to to run through the whole list and map all necessary drives.
I checked out MarcD's logon script FAQ faq329-5798 and Im not having any luck getting that to do what I need it to.
HELP, PLEASE!
I checked out MarcD's logon script FAQ faq329-5798 and Im not having any luck getting that to do what I need it to.
HELP, PLEASE!
Code:
' ======================================================
' DEFINE AD GROUP CONSTANTS
' ======================================================
Const GROUP1 = "cn=group1"
Const GROUP2 = "cn=group2"
Const GROUP3 = "cn=group3"
Const GROUP4 = "cn=group4"
' ======================================================
' MAP HOME DRIVE H:
' ======================================================
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:", "\\server\home\" & wshNetwork.UserName
' ======================================================
' MAP HOME DRIVE G:
' ======================================================
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "g:", "\\server\data"
' ======================================================
' MAP HOME DRIVE J:
' ======================================================
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "j:", "\\server\public"
' ======================================================
' COMPILE USER GROUP MEMBERSHIPS
' ======================================================
set ADSysInfo = CreateObject("ADSystemInfo")
set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
if IsArray(CurrentUser.MemberOf) then
strGroups = LCase(Join(CurrentUser.MemberOf))
else
strGroups = LCase(CurrentUser.MemberOf)
end if
set ADSysInfo = nothing
set CurrentUser = nothing
' ======================================================
' MAP DRIVES
' ======================================================
If InStr(strGroups, GROUP1) Then
wshNetwork.MapNetworkDrive "i:", "\\server\data\folder"
wshNetwork.MapNetworkDrive "k:", "\\server\data\folder"
ElseIf InStr(strGroups, GROUP2) Then
wshNetwork.MapNetworkDrive "i:", "\\server\data\folder"
ElseIf InStr(strGroups, GROUP3) Then
wshNetwork.MapNetworkDrive "i:", "\\server\data\folder"
ElseIf InStr(strGroups, GROUP4) Then
wshNetwork.MapNetworkDrive "p:", "\\server\data\folder"
End If