none
Date last Windows update was done, use get-hotfix? RRS feed

  • Question

  • Hi,

    I like to verify the date last Windows update ran on a machine.

    Got this but not so sure it gives the exact result (some machines do not have a result):

     $((Get-HotFix -ComputerName $Computer | Sort-Object installedon -Descending)[0].InstalledOn).tostring('dd/MM/yy')

    Please advise.
    J.


    Jan Hoedt

    Tuesday, February 21, 2017 10:48 AM

Answers

  • When using Get-Hotfix remotely to a Windows 7 system from WMF 5 the Install date is returned for most updates.  Older updates may not have an installdate.  Return all hotfixes and look to see if the installdate is available.

    Get-Hotfix | ?{$_.InstalledOn -ne '' }


    \_(ツ)_/

    • Marked as answer by janhoedt Wednesday, February 22, 2017 4:58 PM
    Tuesday, February 21, 2017 3:28 PM
  •  Get-WmiObject win32_quickfixengineering  -computer $computer

    \_(ツ)_/

    • Marked as answer by janhoedt Wednesday, February 22, 2017 4:57 PM
    Tuesday, February 21, 2017 4:20 PM

All replies

  • Get-HotFix -ComputerName $Computer | 
    	Sort-Object installedon -Descending |
    	Select -First 1


    \_(ツ)_/

    Tuesday, February 21, 2017 2:18 PM
  • Thanks, but when I execute that the "installedon" is empty.

    Jan Hoedt

    Tuesday, February 21, 2017 3:17 PM
  • That may be the case in many systems.  InstalledOn is only available in Windows 8.1 and later I believe.


    \_(ツ)_/

    Tuesday, February 21, 2017 3:19 PM
  • It's a Windows 2012 r2 system.
    However, I need to execute it to W7 machines too so not a valid solution for me then.

    Jan Hoedt

    Tuesday, February 21, 2017 3:20 PM
  • Thanks, but when I execute that the "installedon" is empty.

    Jan Hoedt

    Just to clarify, when you run just the
    Get-HotFix -ComputerName $Computer 
    line, is it returning nothing at all, or is it returning the hotfix Name and ID with no date in the InstalledOn field?
    Tuesday, February 21, 2017 3:23 PM
  • When using Get-Hotfix remotely to a Windows 7 system from WMF 5 the Install date is returned for most updates.  Older updates may not have an installdate.  Return all hotfixes and look to see if the installdate is available.

    Get-Hotfix | ?{$_.InstalledOn -ne '' }


    \_(ツ)_/

    • Marked as answer by janhoedt Wednesday, February 22, 2017 4:58 PM
    Tuesday, February 21, 2017 3:28 PM
  • Works when I use 

    Get-Hotfix -ComputerName prod610 | ?{$_.InstalledOn -notlike ' ' } 

    Works on W7 but on other RDS 2012 server I get no result with a date in it.
    Maybe the get-hotfix is not a good idea after all.


    Jan Hoedt

    Tuesday, February 21, 2017 4:04 PM
  •  Get-WmiObject win32_quickfixengineering  -computer $computer

    \_(ツ)_/

    • Marked as answer by janhoedt Wednesday, February 22, 2017 4:57 PM
    Tuesday, February 21, 2017 4:20 PM
  • Just a heads up, seems the install dates are inconsistent on Windows 2008 R2. The GUI seems to show 4th of September (as per the date locale) but powershell shows 9th April (US date locale):


    Monday, September 10, 2018 5:50 AM