Link to home
Start Free TrialLog in
Avatar of philmaceri

asked on

Windows Vista will not automatically map drives via VBS logon script

For some reason my Windows Vista laptop will not run our VBS logon script that maps our drives.  Well I should say that it doesn't get run.  If I browse on the network to the script and run it, my drives get mapped without any problems.  So its just not running on logon or some setting is not allowing it to run.  Any ideas anyone?
Avatar of LeeTutor
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's being blocked by default.

Lee is on this one!

Avatar of cbresnehan

I have the same issue, vista client .vbs login script not running, I can manually browse to the location and run the .vbs script and it executes fine and maps drives, however UAC is turned OFF on the clients.

I can find nothing in the event logs, the group policy logs list all the policy items correctly, and it even has an entry saying logon scripts completed successfully.
'          Logon VBScript
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
'Remove all existing mapped drives
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
    objNetwork.RemoveNetworkDrive colDrives.Item(i)
'Determine Group Membership
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN
'Map drives depending upon group membership
Select Case strGroupName
  Case "AD_Group_Name"
    objNetwork.MapNetworkDrive "M:", "\\server\share1"
    objNetwork.MapNetworkDrive "N:", "\\server\share2"
    objNetwork.MapNetworkDrive "Q:", "\\server\share3"
    objNetwork.MapNetworkDrive "S:", "\\server\share4"
    objNetwork.MapNetworkDrive "V:", "\\server\share5"
  Case "AD_Group_Name2"
    objNetwork.MapNetworkDrive "X:", "\\server\share1"
  Case "AD_Group_Name3"
    objNetwork.MapNetworkDrive "T:", "\\server\share2"
  Case "AD_Group_Name4"
    objNetwork.MapNetworkDrive "Z:", "\\server\share3"
  Case "AD_Group_Name5"
    objNetwork.MapNetworkDrive "O:", "\\server\share5"
  Case "AD_Group_Name6"
    objNetwork.MapNetworkDrive "Q:", "\\server\share5"
    objNetwork.MapNetworkDrive "U:", "\\server\share6"
End Select

Open in new window

This discussion is closed but the link to the answer is no longer available. It would be nice if people would put the actual answer in the answer spot instead of a link to a website that can change over time. I'll have to keep hunting.
I found the answer using the link above on This is what I got back: