0

I want to check via PowerShell for the latest date when security updates were installed. Therefore I'd like to use something like this:

Get-WmiObject Win32_QuickFixEngineering | Where-Object {
    $_.Description -eq "Security Update"
}

I tried using Get-CimInstance -Class, but that's not working on Windows 7.

Output is like this:

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
VM10111       Security Update  KB4014579     NT-AUTORITÄT\SYSTEM  05.11.2017 00:00:00

Is the date incorrectly formatted or incorrectly displayed? How to avoid this?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
cuilster
  • 123
  • 1
  • 12

1 Answers1

1

The date is being displayed in MM.DD.YYYY format. So the actual date that is being represented is 11th May 2017 and it is not 5th November 2017.

You Can also try the command

Get-HotFix | where {$_.Description -eq 'Security Update'}

to get the Installed security patches

Venkatakrishnan
  • 776
  • 11
  • 26
  • Thanks, but the behavior seems to be different in Win10 than in Win7. Furthermore I can't successfully format the output using Get-Date -Format ("dd.MM.yyyy") – cuilster Jun 12 '17 at 11:20
  • @cuilster if this solution solved your problem, please mark it as an answer. thank you – Venkatakrishnan Jun 12 '17 at 11:41
  • Your command is equivalent. The date is beeing wrong displayed in Win7. When I convert the InstalledOn you see the problem. `code` $upd = Get-WmiObject win32_quickfixengineering | Where-Object { $_.Description -eq "Security Update" } | where-Object { $_.InstalledOn -gt (Get-Date).AddMonths(-3)}| Sort-Object InstalledOn | Select-Object -Last 1| Select -ExpandProperty "InstalledOn" $upt2 = (Get-Date $upd).ToString("MM.dd.yyyy") echo $upt2 `code` 11.05.2017 – cuilster Jun 12 '17 at 12:09