- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Example
Get-HotFix
Output
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,
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,
Example
Get-HotFix -ComputerName LabMachine2k12,AD,LabMachine2k16
Advertisements