Get-HotFixInfo
Windows: Retrieves installed hotfixes and software updates
#Requires -Version 5.1
[CmdletBinding()]
Param
(
[string]$ComputerName = $env:COMPUTERNAME,
[pscredential]$Credential,
[string]$Id,
[string[]]$Properties = @('HotFixID', 'Description', 'InstalledOn', 'InstalledBy', 'Caption')
)
Process
{
try
{
$hotFixParams = @{
'ErrorAction' = 'Stop'
}
if (-not [string]::IsNullOrWhiteSpace($ComputerName))
{
$hotFixParams.Add('ComputerName', $ComputerName)
}
if ($null -ne $Credential)
{
$hotFixParams.Add('Credential', $Credential)
}
if (-not [string]::IsNullOrWhiteSpace($Id))
{
$hotFixParams.Add('Id', $Id)
}
$hotfixes = Get-HotFix @hotFixParams
if ($null -ne $hotfixes)
{
$result = $hotfixes | Select-Object -Property $Properties | Sort-Object InstalledOn -Descending
Write-Output $result
}
}
catch
{
throw
}
}Specifies the name of the computer to query. Defaults to the local computer.
Specifies a PSCredential object for remote connection.
Specifies the HotFix ID (e.g., KB123456) to retrieve specifically.
Specifies the list of properties to include in the output.