Action1 5 How-to Articles 5 PowerShell One-liner to Check for Missing Windows Updates

PowerShell One-liner to Check for Missing Windows Updates

January 3, 2023

By Mike Walters

Here is a very short PowerShell one-liner that checks for missing Windows updates on the local computer:

(New-Object -ComObject Microsoft.Update.Session).CreateupdateSearcher().Search(“IsHidden=0 and IsInstalled=0”).Updates | Select-Object Title

An alternative way to do this is to use the Get-WindowsUpdate cmdlet to retrieve a list of available updates. To check for updates that have not yet been installed, you can use the -IsInstalled parameter and set it to $false:

GetWindowsUpdate IsInstalled $false

Both methods should return the same result – retrieve a list of updates that are available to be installed, but have not yet been installed on the system.

Here is another cool PowerShell one-liner script that installs all missing updates:

GetWindowsUpdate IsInstalled $false | InstallWindowsUpdate

This script will install all of the missing updates that were returned by the Get-WindowsUpdate cmdlet. You can also use the -MicrosoftUpdate parameter to specify that you want to install updates from Microsoft Update, rather than just Windows Update.

P.S. Checking for missing Windows updates via scripts is a very common troubleshooting technique utilized by users of commodity RMMs not specifically designed for patch management. Give Action1 a shot to see why it’s the best purpose-built patch management system. It’s free for your first 100 endpoints.

See What You Can Do with Action1 RMM

 

Join our weekly LIVE webinar “Patching and remote management” to learn more

about Action1 RMM features and use cases for your IT needs.

 

spiceworks logo
getapp logo review
software advice review
trustradius
g2 review
spiceworks logo

Related Posts