title: Powershell script: Find hotfix status
date: 2015-02-01 14:14:00 +0200 +0200
draft: false
author: John Roos
----
I was browsing around the requests on the Microsoft Script Center the other day and found one request where a user needed a PowerShell script for showing the status of specific hotfixes on multiple machines. I thought it would be a good idea since Get-Hotfix only shows where the hotfix is installed but not directly where its not installed.
I created a simple small script that would list the patches to check for, along with each server and if its installed or not. The output looks something like this:
ComputerName Hotfix Status
------------ ------ ------
server01 KB2991963 Installed
server01 KB2923423 Not installed
server02 KB2991963 Installed
server02 KB2923423 Not installed
The script outputs one object per server and hotfix. So each line in the output above represents one object. In this way you can easily format it or pipe it to other commands. Here is one example where I want to look for the status of hotfixes called KB2991963 and KB2923423 on two servers:
.\Find-Hotfix.ps1 -Hotfix 'KB2991963', 'KB2923423' -ComputerName 'server01', 'server02'
You could also use the FilePath parameters in case you have a list of servers and/or a list of hotfixes in text files:
.\Find-Hotfix.ps1 -Hotfix_FilePath 'c:\hotfixes.txt' -ComputerName_FilePath 'c:\servers.txt'
The script can be downloaded from Microsoft Script Center here.
Powershell script: Find hotfix status
I was browsing around the requests on the Microsoft Script Center the other day and found one request where a user needed a PowerShell script for showing the status of specific hotfixes on multiple machines. I thought it would be a good idea since Get-Hotfix only shows where the hotfix is installed but not directly where its not installed.
I created a simple small script that would list the patches to check for, along with each server and if its installed or not. The output looks something like this:
ComputerName Hotfix Status
------------ ------ ------
server01 KB2991963 Installed
server01 KB2923423 Not installed
server02 KB2991963 Installed
server02 KB2923423 Not installed
The script outputs one object per server and hotfix. So each line in the output above represents one object. In this way you can easily format it or pipe it to other commands. Here is one example where I want to look for the status of hotfixes called KB2991963 and KB2923423 on two servers:
.\Find-Hotfix.ps1 -Hotfix 'KB2991963', 'KB2923423' -ComputerName 'server01', 'server02'
You could also use the FilePath parameters in case you have a list of servers and/or a list of hotfixes in text files:
.\Find-Hotfix.ps1 -Hotfix_FilePath 'c:\hotfixes.txt' -ComputerName_FilePath 'c:\servers.txt'
The script can be downloaded from Microsoft Script Center here.
- Written by John Roos on February 1, 2015