Re: Close Command Prompt upon ping time out ?



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
--


.



Relevant Pages

  • Re: Auto Logon Remotely
    ... We are calling the .exe from a remote machine through that command ... Thanks again for your prompt responses to my posts! ... > | calling a standalone application that resides on this particular server ...
    (microsoft.public.windows.server.scripting)
  • Re: no _udp SRV in DNS
    ... Correction on my first message though...I can ping my gateway ... from the server. ... > Web Site and run netdiag /fix from a command prompt. ... Someone told me that under the forward lookup zone ...
    (microsoft.public.win2000.active_directory)
  • Re: no _udp SRV in DNS
    ... Correction on my first message though...I can ping my gateway ... from the server. ... > Web Site and run netdiag /fix from a command prompt. ... Someone told me that under the forward lookup zone ...
    (microsoft.public.win2000.advanced_server)
  • RE: help: x server
    ... do you successfully login through command prompt and then issue a command ... Subject: help: x server ... since then my xwindow in not working. ...
    (RedHat)
  • Re: cant access FTP server
    ... Are you trying this from the command line or Internet Explorer? ... You should now be given a login prompt where you will type your name, ... Here is a sample of me logging into Computer Associates FTP server using the ...
    (microsoft.public.windowsxp.general)

Quantcast