Export (0) Print
Expand All

Get-HotFix

Updated: December 3, 2014

Applies To: Windows PowerShell 4.0

Get-HotFix

Gets the hotfixes that have been applied to the local and remote computers.

Syntax

Parameter Set: Default
Get-HotFix [[-Id] <String[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [ <CommonParameters>]

Parameter Set: Description
Get-HotFix [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Description <String[]> ] [ <CommonParameters>]




Detailed Description

The Get-Hotfix cmdlet gets hotfixes (also called updates) that have been installed on either the local computer (or on specified remote computers) by Windows Update, Microsoft Update, or Windows Server Update Services; the cmdlet also gets hotfixes or updates that have been installed manually by users.

Parameters

-ComputerName<String[]>

Specifies a remote computer. The default is the local computer.

Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of a remote computer.

This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter of Get-Hotfix even if your computer is not configured to run remote commands.


Aliases

none

Required?

false

Position?

named

Default Value

Local computer

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies a user account that has permission to perform this action. The default is the current user.

Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.


Aliases

none

Required?

false

Position?

named

Default Value

Current user

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String[]>

Gets only hotfixes with the specified descriptions. Wildcards are permitted. The default is all hotfixes on the computer.


Aliases

none

Required?

false

Position?

named

Default Value

All hotfixes

Accept Pipeline Input?

false

Accept Wildcard Characters?

true

-Id<String[]>

Gets only hotfixes with the specified hotfix IDs. The default is all hotfixes on the computer.


Aliases

none

Required?

false

Position?

1

Default Value

All hotfixes

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You cannot pipe input to Get-HotFix.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Management.ManagementObject#root\CIMV2\Win32_QuickFixEngineering

    Get-Hotfix returns objects that represent the hotfixes on the computer.


Notes

  • This cmdlet uses the Win32_QuickFixEngineering WMI class, which represents small system-wide updates of the operating system. Starting with Windows Vista, this class returns only the updates supplied by Microsoft Windows Installer (MSI), Windows Update, Microsoft Update, or Windows Server Update Services. It does not include updates that are supplied by Component Based Servicing (CBS), or other non-hotfix programs or apps. For more information, see the Win32_QuickFixEngineering class topic in the Microsoft .NET Framework SDK at http://go.microsoft.com/fwlink/?LinkID=145071.

    The output of this cmdlet might be different on different operating systems.

Examples

-------------------------- EXAMPLE 1 --------------------------

This command gets all hotfixes on the local computer.


PS C:\> get-hotfix

-------------------------- EXAMPLE 2 --------------------------

This command gets all hotfixes on the Server01 and Server02 computers that have a description that begins with "Security".


PS C:\> get-hotfix -description Security* -computername Server01, Server02 -cred Server01\admin01

-------------------------- EXAMPLE 3 --------------------------

The commands in this example create a text file listing the names of computers that are missing a security update.

The commands use the Get-Hotfix cmdlet to get the KB957095 security update on all of the computers whose names are listed in the Servers.txt file.

If a computer does not have the update, the Add-Content cmdlet writes the computer name in the Missing-KB953631.txt file.


PS C:\> $a = get-content servers.txt
PS C:\>$a | foreach { if (!(get-hotfix -id KB957095 -computername $_)) { add-content $_ -path Missing-kb953631.txt }}

-------------------------- EXAMPLE 4 --------------------------

This command gets the most recent hotfix on the computer.

It gets the hotfixes, sorts them by the value of the InstalledOn property, and then it uses array notation to select the last item in the array.


PS C:\> (get-hotfix | sort installedon)[-1]

Related topics



Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft