You probably know the very good and very popular module of Michal GADJA named PSWindowsUpdate.
At the time of this writing, the latest version is 2.0.0.0 and can be downloaded from the Powershell Gallery here.
I just wanted to add an undocumented behavior of the Get-WUInstall cmdlet.
If your computer is not configured to install updates from a WSUS server, you won’t notice any difference between these three command-lines:
Get-WUInstallGet-WUInstall -WindowsUpdateGet-WUInstall -MicrosoftUpdate
Conversely, if your computer is configured to install updates from a WSUS server, here is what happens:
Get-WUInstallinstalls all approved updates from the WSUS serverGet-WUInstall -WindowsUpdateinstalls all available updates from the WSUS server (even declined updates !!!)
The complete list depends on how you configured your WSUS server and which Products and Classifications you decided to download from Microsoft Update to you WSUS server.Get-WUInstall -MicrosoftUpdateinstalls all available updates (really everything) from Microsoft Update (the Microsoft online database).