Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to you determine when Windows is done rebooting?

I am using the Windows Update API to update a bunch of VM's. With Windows Update comes the inevitable reboots. Can anyone think of a way that I could tell from a remote server if the windows box has indeed finished its reboot? All ideas or thoughts would appreciated.

EDIT: Because the VM's are in Lab Manager and using a fenced configuration, WMI will not work, and although I thought about using the VM to send a signal when it was back up. There would have been no way to reliably know who to notify as the app waiting for the machine could be on any number of machines so it just didn't seem reasonable. However time is not essential (and even though I know this will bite me sometime when a Service Pack comes down) I have had good success with the PING and then wait 5 minutes so far, so I am going to use that for now. If I run into exceptions I will then try to implement the VM notfiying the world when it comes back up. Thanks to all.

like image 444
Alex Avatar asked Apr 21 '09 18:04

Alex


People also ask

How can I tell when Windows last rebooted?

Open Start. Search for Command Prompt, right-click the top result and click the Run as administrator option. Type the following command to query the device's last boot time and press Enter: wmic path Win32_OperatingSystem get LastBootUpTime.

How long does a reboot usually take?

Resetting a PC could take from 30 minutes up to 3 hours; however, it also depends on many factors. Like what storage device you're using, how much data is on your PC, and how many files you want to keep from getting wiped out.


2 Answers

Just wait for it to respond to a ping.

In light of your comments:

1 - Use this script

2 - If you get any errors with that script, follow these instructions.

like image 178
JosephStyons Avatar answered Sep 19 '22 12:09

JosephStyons


Check for this event in the event log:

Event Type: Information
Event Source:   EventLog
Event Category: None
Event ID:   6005
Date:       7/27/2007
Time:       12:56:24 PM
User:       N/A
Computer:   IWSDEV
Description:
The Event log service was started.
like image 30
Otávio Décio Avatar answered Sep 21 '22 12:09

Otávio Décio