Vbs: ping and map network drive

Hi, I have written an script that maps network drives to a local computer. At first it pings remote PC, if there is a ping, the script maps the drive (this works just fine). If there is not a ping - it pings the remote pc as long as ping appears. (this is not working)- when the ping appears i got error message:

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
[1825 byte] By [not_a_guru] at [2007-11-19 23:18:18]
# 1 Re: Vbs: ping and map network drive
Anybody, please help. I don't have any clue where is the problem... :(
not_a_guru at 2007-11-8 0:40:27 >