Vbs: ping and map network drive
Line: 45
Char: 1
Error: The network path not found
Code: 80070035
Source: WSHNetwork.MapNetworkDrive
but the path is correct and share name is also correct.
Please help!
Here is my VBScript
strTarget = "192.168.13.152"
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set objShell = Wscript.CreateObject("Wscript.Shell")
objName = objFSO.GetTempName
objTempFile = objName
objShell.Run "cmd /c ping -n 5 -w 1000 " & strTarget &" >" & objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(objTempFile, 1)
ping=false
Do While objTextFile.AtEndOfStream <> True
strText = objTextFile.ReadLine
If (Instr(strText, "Reply") > 0) Or (ping=true) Then
mapNetworkDrive()
Exit Do
ElseIf Instr(strText, "Request") > 0 Then
objShell.Run "cmd /c ping -n 5 -w 1000 " & strTarget &" >" & objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(objTempFile, 1)
If Instr(strText, "Reply") Then
ping=true
Exit Do
End if
End If
Loop
objTextFile.Close
objFSO.DeleteFile(objTempFile)
Function mapNetworkDrive()
Dim objNetwork
Dim strDriveLetter
Dim objShell
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "W:" , "\\192.168.13.152\test"
End Function
Thanks in advance

