Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #5 Get-Hotfix

    Posted on November 18th, 2009 Jonathan Medd 2 comments

    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 ;-)

    1000 things 1% better!

     

    2 responses to “PowerShell 2.0: One Cmdlet at a Time #5 Get-Hotfix” RSS icon

    • I thought get-hotfix was the same as the WMI QFE, just in cmdlet form.

    • Indeed, it does look that way as you will see my note on piping both cmdlets to Get-Member.

      There are some differences though like being able to use wildcards with the Description parameter.


    Leave a reply