Last active
May 31, 2023 10:09
-
-
Save SMSAgentSoftware/982742af3f30c26b279a9acf9d9e60f3 to your computer and use it in GitHub Desktop.
PowerShell 'one-liner' to get Windows Update history using the PackageManagement module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Package -ProviderName msu | | |
Select Name, | |
@{l='UpdateType';e={ | |
If ($_.Name -match "Antivirus" -or $_.Name -match "antimalware") | |
{"Definition Update"} | |
ElseIf ($_.Metadata.Item("SupportUrl") -match "target=hub") | |
{"Driver Update"} | |
ElseIf ($_.Summary -match "latest version of Windows") | |
{"Feature Update"} | |
ElseIf ($_.Name -match "Malicious Software Removal" -or $_.Name -match "Intelligence Update") | |
{"Other Update"} | |
Else {"Quality Update"} | |
} | |
}, | |
@{l='InstallDate';e={[DateTime]::Parse($_.Metadata.Item("Date"))}}, | |
@{l='ResultCode';e={$_.Metadata.Item("ResultCode")}}, | |
Status, | |
@{l='SupportUrl';e={$_.Metadata.Item("SupportUrl")}}, | |
Summary | | |
Sort -Property UpdateType,InstallDate -Descending | | |
Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment