Monday, July 30, 2012

Script to map drive on startup


Option Explicit
Dim objNetwork, objExp
Dim strDriveLetter, strRemotePath
Dim filesys
strDriveLetter = "Z:"
Set filesys = CreateObject("Scripting.FileSystemObject")
If Not filesys.DriveExists(strDriveLetter) Then 
   strRemotePath = "\\Path\Required"
   Set objNetwork = CreateObject("WScript.Network")
   objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
   WScript.Quit
End If

No comments: