Hi all,
I recently setup a gpo to map network drives and its working good except for the annoying red X. I got the script from this board, i think from markdmac's post.
here it is, can someone tell me why i have the red X?
thanks!
Set WshShell = WScript.CreateObject("WScript.Shell")
Set GuyNet = WScript.CreateObject("WScript.Network")
Set CheckDrive = GuyNet.EnumNetworkDrives()
DriveLetter = "Z:"
RemotePath = "\\server\share"
AlreadyConnected = False
For i = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = True then
GuyNet.RemoveNetworkDrive DriveLetter
GuyNet.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp "Drive " & DriveLetter & "Disconnected, then connected successfully."
Else
GuyNet.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
End if
I recently setup a gpo to map network drives and its working good except for the annoying red X. I got the script from this board, i think from markdmac's post.
here it is, can someone tell me why i have the red X?
thanks!
Set WshShell = WScript.CreateObject("WScript.Shell")
Set GuyNet = WScript.CreateObject("WScript.Network")
Set CheckDrive = GuyNet.EnumNetworkDrives()
DriveLetter = "Z:"
RemotePath = "\\server\share"
AlreadyConnected = False
For i = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = True then
GuyNet.RemoveNetworkDrive DriveLetter
GuyNet.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp "Drive " & DriveLetter & "Disconnected, then connected successfully."
Else
GuyNet.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
End if