I have an installation PowerShell script that installs Docker and other components onto Windows Server 2016. I have learned (the hard way) that if the latest Windows Updates are not installed, sometimes Docker will get into a very wierd state and not function as expected.
Therefore, I would like to programmatically check in PowerShell if all available/latest Windows Updates are installed on the server and then show a warning to the user if there are available updates that are not installed.
So the question is, how to programmatically check if all available/latest Windows Updates are installed?
Any help would be greatly appreciated.
I suggest identifying exactly which updates are dependencies for Docker to work properly, and verifying those are installed specifically. It's surprisingly hard to emulate the "Check for Updates" button in PowerShell.
These are the built in commands, but they aren't documented and are just wrappers for WMI method calls.
Documentation Team issue discussing lack of documentation https://github.com/MicrosoftDocs/windows-powershell-docs/issues/139
PowerShell Team issue discussing the broken functionality https://github.com/PowerShell/PowerShell/issues/5718
This person seems to have figured out how to use the commands. https://richardspowershellblog.wordpress.com/2017/11/17/windows-update-change-in-server-1709/