Todd
Fri Mar 14 14:08:01 CDT 2008
"Evertjan." wrote:
> =?Utf-8?B?VG9kZA==?= wrote on 14 mrt 2008 in
> microsoft.public.inetserver.asp.general:
>
> > Hello I'm using the following script to try and ping:
> >
> > <% Response.Buffer = true %>
> > <%
> > url = "www.espn.com"
> >
> > Set objWShell = CreateObject("WScript.Shell")
> > Set objCmd = objWShell.Exec("ping " & url)
> > strPResult = objCmd.StdOut.Readall()
> > set objCmd = nothing: Set objWShell = nothing
> >
> > strStatus = "offline"
> > if InStr(strPResult,"TTL=")>0 then strStatus = "online"
> >
> > response.write url & " is " & strStatus
> > response.write ".<br>" & replace(strPResult,vbCrLf,"<br>")
> > %>
> >
> > I am getting the following error on the objWShell.Exec("ping " & url):
> >
> > WshShell.Exec error '80070005'
> >
> > Access is denied.
> >
> > /test.asp, line 6
> >
> >
> > I can understand there being permssions errors if I was moving files
> > around in different directories but this is a straight ping. There
> > shouldnt be any permissions error by my thinking. Any help would be
> > appreciated.
>
> read this perhaps:
>
> <
http://www.microsoft.com.nsatc.net/technet/scriptcenter/resources/qanda/
> sept04/hey0914.mspx>
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>
Tried both Win 2000 options on that site and getting the same errors at the
same locations (.Exec on the first one and .Run on the second. For your
convenience here si the two scripts I tried running (replacing the IP with
something local to me).
Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec _
("%comspec% /c ping -n 3 -w 1000 192.168.1.1")
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()
If Instr(strText, "Reply") > 0 Then
Wscript.Echo "Reply received."
Else
Wscript.Echo "No reply received."
End If
Loop
--------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
objName = objFSO.GetTempName
objTempFile = objName
objShell.Run "cmd /c ping -n 3 -w 1000 192.168.1.1 >" & _
objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(objTempFile, 1)
Do While objTextFile.AtEndOfStream <> True
strText = objTextFile.ReadLine
If Instr(strText, "Reply") > 0 Then
Wscript.Echo "Reply received."
Exit Do
End If
Loop
objTextFile.Close
objFSO.DeleteFile(objTempFile)
Hope this helps narrow down the problem.
Thank You