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 18.104.22.168 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 !!!)
Get-WUInstall -MicrosoftUpdateinstalls all available updates from Microsoft Update (the Microsoft online database).