Powershell – How to check for available “Automatic Updates” via script / cli

powershellwindows-server-2003windows-server-2008

I asked this on superuser, but I think this may have been a more apropriate place. We are trying to automate server reboots, but one of the "gotchas" we are running into are that they want us to install updates by manually clicking "sure, install updates" during monthly Windows reboots. If I had a way to check to see if updates are in fact waiting, we'd be ok with rebooting automatically via a script and just failing if this is the case. My problem is I can't figure out how to check to see if there are in fact updates waiting to be installed, without logging in. Is there a file or particular service status I can check for? Maybe with Powershell or something similar? The current setting used is "Download updates but do not install automatically"

Best Answer

Check out my question (and answer) here You should be able to modify that script to get the info you need.