Re: Close Command Prompt upon ping time out ?
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 9 Sep 2007 08:19:18 -0500
Spike Craib wrote:
I'm writing a vbscript to shutdown a number of remote computers. After the
script issues the remote shutdown to each computer it opens a Command
Prompt
window for each server and runs
ping -t <hostname>
for each server in the list. What I want to be able to do is get the
vbscript to call the Command Prompt and ping the server until a "request
timed out" is returned, where it should then close the Command Prompt
window.
Anyone have any ideas ?
I don't know of an easy way to do this. However, I have 3 example functions
that ping computers in this link:
http://www.rlmueller.net/PingComputers.htm
The functions return True or False. These can be used in a loop to determine
when the remote computer shuts down. For Example:
=======
intCount = 0
blnDown = False
Do Until intCount = 10
If (PingComputer(strComputer, 1, 750) = False) Then
Exit Do
blnDown = True
End If
Wscript.Sleep 5000
intCount = intCount + 1
Loop
========
I use a counter to avoid an infinite loop. The computer is pinged 10 times
with a 5 second pause between each. After the loop if blnDown is True the
machine was successfully shutdown. If blnDown is False machine still
responded after 10 pings.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- Re: Close Command Prompt upon ping time out ?
- From: ThatsIT.net.au
- Re: Close Command Prompt upon ping time out ?
- Prev by Date: Re: How to check subfolders not modifed in last two days?
- Next by Date: Re: Close Command Prompt upon ping time out ?
- Previous by thread: How to check subfolders not modifed in last two days?
- Next by thread: Re: Close Command Prompt upon ping time out ?
- Index(es):
Relevant Pages
|