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 22.214.171.124 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:
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 server
Get-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).