I'm having trouble getting drives mapped for my domain. I few months ago we were using Group Policy Preferences to map drives, but for some reason it stopped working - so I created a few login scripts for the various divisions in my company to map drives. But those didn't completely work either.
As far as I can tell the GPOs with the login scripts are being ran upon login, but the drives are still not being mapped. Manually executing the .vbs script successfully maps the drives, it's just not mapping them when the user logs in.
Running gpresult /r shows the login script GPO was ran, and viewing the
Applications and Services\Microsoft\Windows\GroupPolicy\Operational event log, I can see the Event 4016 where it says:
Starting Scripts Extension Processing.
List of applicable Group Policy objects: (Changes were detected.)
Share Drives GPO
So the GPO is being run, and the script works when executing manually - but the drives are not being mapped when the user logs in. Here is a sample from the script I am using:
On Error Resume Next If err.number = vbEmpty then Set objShell = Create("WScript.Shell") objShell.run ("Explorer") ElseIf err.number = -2147022646 then Wscript.Echo "You must create" & strDriveLetter Else Wscript.echo "Unknown " & err.number End if ' Map H Drive Set objectNetwork = CreateObject("Wscript.Network") objectNetwork.RemoteNetworkDrive "H:" objectNetwork.MapNetworkDrive "H:", "\\Path\to\FileServer" Set objectShell = CreateObject("Shell.Application") objectShell.NameSpace("H:").Self.Name = "Name Applied to Drive Letter" ' Map I Drive Set objectNetwork = CreateObject("Wscript.Network") objectNetwork.RemoteNetworkDrive "I:" objectNetwork.MapNetworkDrive "I:", "\\OtherPath\to\FileServer" Set objectShell = CreateObject("Shell.Application") objectShell.NameSpace("I:").Self.Name = "Name Applied to Drive Letter"
and so on for each drive letter that applies to the user.