How to get installed windows update using PowerShell?

To get the installed windows updates using PowerShell, we can use the Get-Hotfix command. This command gets the hotfixes and updates that are installed on the local and the remote computer.

This command is the part of Microsoft.Management.PowerShell utility.




PS C:\> Get-HotFix
Source Description HotFixID InstalledBy InstalledOn
------ ----------- -------- ----------- -----------
LABMACHINE... Update KB3191565 LABMACHINE2K12\Ad... 1/15/2021 12:00:00 AM
LABMACHINE... Update KB2999226 LABMACHINE2K12\Ad... 1/13/2021 12:00:00 AM

In the above output, you can see the SourceMachine Name, HotfixID, InstalledBy, and the Installed Date.

You can also sort it by the InstalledOn parameter. For example,


Get-HotFix | Sort-Object InstalledOn -Descending

This command supports the ComputerName parameter which is a string array so we can pass the multiple remote computers to get the installed hotfixes.

PS C:\> help Get-HotFix -Parameter ComputerName
-ComputerName <System.String[]>
Specifies a remote computer. Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name (FQDN) of a remote computer.

For example,


Get-HotFix -ComputerName LabMachine2k12,AD,LabMachine2k16

Updated on: 08-Feb-2021

12K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started