MapNetwork drive

MapNetwork drive

Post by Jaso » Sat, 31 Mar 2007 02:57:19


I'm currently mapping a network in my script, but what if that drive is not
onlone for some reason. How can I tell, so I can take the appropriate
action? Will that method return something I can branch off of?


MapNetwork drive

Post by dXJrZW » Sat, 31 Mar 2007 23:10:01

You can check the Err object:

On Error Resume Next

Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "G:", "\\Test\Test"
If Err.number <> 0 Then
WScript.Echo Err.Description
End If