How do you determine when Windows restarts?

I am using the Windows Update API to update a group of virtual machines. With Windows Update, an inevitable reboot occurs. Can anyone think of a way that I could tell from a remote server if the Windows window really finished rebooting it? Any ideas or thoughts will be appreciated.

EDIT: Since the virtual machine is located in Lab Manager and uses a secure configuration, WMI will not work, and although I thought about using a virtual machine to send a signal when backing it up. There would be no way to reliably find out who will notify how the application expects the machine to be on any number of machines, so this just doesn't seem reasonable. However, the time is not significant (and even if I know that it will bite me sometime when the Service Pack falls), I had a good success with PING, and then wait 5 minutes, so I'm going to use it for now. If I run into exceptions, I will try to implement a virtual machine that does not update the world when it returns. Thanks to everyone.

+6
c # windows-update reboot
source share
6 answers

Wait for it to respond to ping.

In the light of your comments:

1 - Use this script

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

+5
source share

Check 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. 
+2
source share

A more general version of this question is How do I know if the system is turned on?

+1
source share

The reality is that you cannot know when it is loading. The download process is quite asynchronous, so any criteria that you use to determine if it is done, the “download” can happen before something else completes.

What I would recommend is what you really want to know. What exactly are you waiting for? Find a way to determine if this has happened and don't forget to worry about the “download”.

If you just need to know that the machine is working, but may not have completed the entire boot after loading, put something in the startup sequence or service that signals your code. When this signal occurs, take all necessary actions.

+1
source share

You can install a launcher or service on your computer to send e-mail or some kind of network cable every time it restarts.

+1
source share

Windows only reboots a bit before restarting again :-)

If you specifically request the status of virtual machines, you should check these API related links for Virtual Server 2005:

IVMVirtualMachine Interface ...

http://msdn.microsoft.com/en-us/library/aa368465(VS.85).aspx

... has the State property ...

IVMVirtualMachine :: State Property

http://msdn.microsoft.com/en-us/library/aa368637(VS.85).aspx

... which will return a value from the VMVMState enumeration ...

http://msdn.microsoft.com/en-us/library/aa368922(VS.85).aspx

At a more general level, you should probably determine how many of Windows you want to start and run. Do you think the network stack is ready to reboot or do you need IIS / SQL or some other application-level service?

I would probably write an application that checks the "heartbeat" of your servers - this application may well be the same as when invoking Windows Update. Then you will get a “console” showing the status of your servers. A heart rate application can execute a ping server, click a static html page, click on a log of remote events, use WMI or whatever you define is enough to consider rebooting your server.

0
source share

All Articles