Is there a way to find out if scheduled Automatic Updates are idle or in progress (checking, downloading, installing)?
Is there a way to find out, if scheduled Automatic Updates are done, if a reboot is needed to finish updating?
,
I am looking for a low-maintenance and free way to set up overnight scheduled automatic updates, that can ONLY run at night and never during the day when people are using the machines. If a machine misses the overnight scheduled Window, that absolutely does
not mean the updates should install the next morning when an employee logs on to the machine and is trying to get their work done.
In general I already know what needs to be done, though it's the finer points of saving energy that are a problem. I don't want to leave machines on all night. I want the machines to turn on, and do their automatic updates from Microsoft as scheduled (no need for WSUS). If a reboot is needed, then do that, and resume updating after the restart if needed. If all done and no restart needed, do some other maintenance tasks like defragging, and shut down the system.
The general plan goes like this:
- AD GPO, Computer policy: Set Windows Update service to Manual start so it cannot run during the daytime, ever. Stop the service if it is running.
- AD GPO, Computer policy: Set Windows Update to automatic updates, automatic install, at 2:00 am
- Power up machines overnight on a schedule (via Wake on LAN scheduler or BIOS timer), at 1:50 am
- AD GPO, Computer policy: Scheduled task to run script every day with Local System user account at 1:55 am
- Script starts Windows Update service (net start wuauserv)
- Script waits about ten minutes for Windows Automatic Updates to start. (2:05 am)
- Poll Windows Update to check status. If busy with checking, downloading or installing, then wait another five minutes and repeat polling task.
- If Windows Update is found to be idle, check if Restart required. If yes, schedule a one-time startup task to restart this script, and reboot the system. On system restart, this script is run again, Windows Update service starts, and updates may continue to install if required.
- If Windows Update is found to be idle, and no restart is needed, defrag all local hard drives, and then shut down the system.
,
It seems simple enough, but I don't see how to read the state of the Windows Update API when it is doing scheduled automatic updates.
It seems possible to try to grep the current status / progress out of the WindowsUpdate.log, but that looks like an extremely painful roll-your-own solution, and I've not found a script yet that's already capable of reading the logfile to get the current state of the Windows Update service.