Graz
Thu Dec 04 13:06:36 CST 2003
aha that would explain it :) if I need to do this for 1000s of PCs wont this
be very slow?
thanks for your help
graz
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCF7F1A.EAA0257@hydro.com...
> Graz wrote:
>
> > (snip)
> > function ping(arg)
> > with createobject("wscript.shell")
> > ping = Not CBool(.run("ping -n 1 " & arg,0,true))
> > end with
> > end function
> >
> > If ping(machine) = true then
> > WScript.Echo "Valid IP"
> > else
> > wscript.echo "Unvalid IP"
> > end if
> > '*****************
> >
> > However when I run it on a W2K machine it only seems to check if the IP
> > address is a valid address NOT whether the machine actually exists. If
you
> > deliberatly input a unused IP address you still get the message back as
> > true.
>
> Hi
>
> Sadly, on Win2k, ping.exe will return errorlevel 0 even if
> computer is unavailable (offline/turned off) but defined in DNS (ping will
> return "Request timed out.")
>
> From my testing, the only time the function will return a correct "False"
value
>
> is where ping returns "Unknown host".
>
> Parsing the output from ping.exe and looking for "TTL=" is the way I have
found
>
> that will work in all situations/languages.
>
>
> The VBScript function IsConnectible in the link below will work on all OS
> versions (it uses ping.exe to ping the host and looks for the text "TTL="
to
> see if it is online):
>
>
http://groups.google.com/groups?selm=3EB2AA54.EBB5ECBC%40hydro.com
>
>
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide:
http://www.microsoft.com/technet/scriptcenter
>
>