Restar-computer wait for next command
hi, in script want restart a server , wait until server run next command.
i know in posh 3 can use -wait need use posh 2
what best way?
restart-computer -computername $svr -asjob
thanks
you a endless loop until server again
issue see is, can successful ping, if server isn't up, , still booting. depending on next tasks, may or may not run correctly.restart-computer $server
do { sleep 10 # sleep 10 secs, test ping }while (!(test-connection $server))
if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.
don't retire technet
Windows Server > Windows PowerShell
Comments
Post a Comment