Featured image of post Blank InstalledOn Property for Get-HotFix and Win32_QuickFixEngineering

Blank InstalledOn Property for Get-HotFix and Win32_QuickFixEngineering

Want to get Windows Update status on a bunch of machines, only to discover the InstalledOn property is blank for lots of updates when you’re using Get-HotFix or querying Win32_QuickFixEngineering class with Get-WmiObject?

Turns out it’s related to PowerShell parsing the date as string to datetime object incorrectly, depending what your system locale is.

$Updates = Get-HotFix | Select-Object description,hotfixid,installedby,@{l="InstalledOn";e={[DateTime]::Parse($["installedon"].value,$([System.Globalization.CultureInfo]::GetCultureInfo("en-US")))}}
$Updates | Sort InstalledOn -Descending | Select -First 10

I like the above approach, as posted by user pyro3113, because the select expression lets you easily query remote systems using Get-HotFix or Get-WmiObject.

These two solutions use the Microsoft.Update.Session COM object. The Windows Update PowerShell Module creates the COM object on a remote host whereas the post by britv8 shows just enough to get you going executing on local host:

Interestingly, using the below command in cmd doesn’t suffer from this data type parsing issue. It’s just spat out as is with no interpretation.

wmic qfe
comments powered by Disqus