dim OlyNet
dim OlyPrinter
dim OlyFSO
dim OlyShell
dim OlyDrives
dim i
dim cmd
on error resume next
set OlyNet = WScript.CreateObject("WScript.Network"
set OlyPrinters = WScript.CreateObject("WScript.Shell"
Set OlyFSO = WScript.CreateObject("Scripting.FileSystemObject"
set OlyShell = CreateObject("WScript.Shell"
set OlyDrives = OlyNet.EnumNetworkDrives
'----- Set Drive Mappings (This clears any existing mappings)
Sub DriveMapping(Drive, Share)
For i = 0 to OlyDrives.Count -1 Step 2
if LCase(Drive) = LCase(OlyDrives.Item(i)) then
if not LCase(Share) = LCase(OlyDrives.Item(i+1)) then
OlyNet.RemoveNetworkDrive Drive, true, true
Else
Exit Sub
End if
End if
Next
OlyNet.MapNetworkDrive Drive, Share
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.