Pages

Monday, December 14, 2020

Simple PowerShell Script to Get the Latest Installed Hotfix and Installed Date

One of our customers had a requirement to get the last installed Windows update and the installed date on several machines through MECM. Since MECM does not offer readily available report for this type of scenario, I used PowerShell instead to query machines and get details.

Below is the script.

This will get list of computer names from a text file and save the results to a separate text file.

$Computers = Get-Content -Path H:\new\names.txt
$Computers | ForEach-Object {(Get-HotFix -ComputerName $_ | Sort-Object `
-Property InstalledOn)[-1] | Format-Table -AutoSize | Out-File -FilePath H:\new\NewFile.txt}

Change -Path and -FilePath parameters accordingly.

No comments:

Post a Comment