PowerShell 2.0: One Cmdlet at a Time 5 Get-Hotfix
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Hotfix cmdlet.
What can I do with it?
Retrieve hotfixes installed on a local or remote computer
Example:
Retrieve a list of hotfixes installed on Server1 which contain Security in their description. Display the Description, HotfixID and Caption properties.
Get-Hotfix -description Security* -computername Server01 | Select-Object Description,HotfixID,Caption
How could I have done this in PowerShell 1.0?
You could have used Get-WMIObject with the Win32_QuickFixEngineering class.
Get-WmiObject -class Win32_QuickFixEngineering -Filter “Description=‘Security Update’” -computername Server01 | Select-Object Description,HotfixID,Caption
Note: We had to specify the full name ‘Security Update’ since the filter parameter of Get-WMIObject does not support wildcard characters. If necessary you could pipe the results to Where-Object instead and use wild card characters, but this is not as efficient.
Funnily enough Get-Hotfix and Get-WMIObject -class Win32_QuickFixEngineering look pretty similar when you pipe them through to Get-Member ;-)