Some times it necessary to put in a small pause in a task sequence. Here is one way to this !
1: Ping the local host 127.0.0.1 N +1 times
PING sends a request, waits for one second then sends the next request! If the switch –n is supplied it will do this N times. Because the first request is send immediately 60 seconds would then be 60 +1 = 61. Because it sends the request to the computer itself, it will reply immediately, or faster than one second, enabling us to use it as a count down timer!
Syntax for pausing 1 minute would be like this:
- CMD.exe /c PING –n 61 127.0.0.1
In a Task Sequence, it looks like this
Why not use a vbscript instead?
Save the following as ‘sleep.vbs’:
Dim Arg
On Error Resume Next
Arg = WScript.Arguments(0)
WScript.Sleep Arg
Call this from command line to wait for 1 minute:
WSCRIPT sleep.vbs 60000
Br.
M
I write one way to do it, and thats another… The benefit of using PING, is, no need to create script, create package and add package to distribution point.. This method works out of the box!
Agreed, and everyone doesn’t know VB; this way is much better, and less cumbersome. Outstanding tip Micheal, thanks and keep up the good work.
Excellent and creative tip, Michael!
To expand on what you said, if you wanted to pause the task sequence indefinitely, you could use the -t parameter of ping.exe. You’d have to ensure that you enable “continue on error” (I think) since you’d have to kill ping.exe forcefully, which would likely return a non-zero exit code.
Cheers,
Trevor Sullivan
Websites worth visiting…
[…]here are some links to sites that we link to because we think they are worth visiting[…]…
Thanks for the tip, I had a need to use this and it worked fine.
For potential users: just be careful to check the command, if you copy the text from the example above it contains an ‘endash’ and not a hyphen and doesn’t work. This text below has a hyphen and works OK:
CMD.exe /c PING -n 61 127.0.0.1
Thanks!!!!! Thats a needle in a haystack
Excellent