locked
Powershell last update installed on computer RRS feed

  • Question

  • Hi,

    I would like to find last date where an update was installed on a computer.

    When I use get-hotfix date is not always shown...

    Is there only wmic qfe to see it ? Because this is not powershell command and whith wmic updates are not ordered by installation date.

    This query seems really complex to do as command line...

    Maybe someone already have solution ?


    Merci de marquer comme reponses les interventions qui vous ont ete utile.

    Thursday, November 7, 2019 8:40 AM

All replies

  • Which date. There are two.

    get-Hotfix| select InstallDate,InstalledON

    WMI and Get-Hotfix are the same thing.


    \_(ツ)_/

    Thursday, November 7, 2019 8:52 AM
  • Hi,

    You have a few options here:

    How to check Windows Update History using PowerShell
    https://www.thewindowsclub.com/check-windows-update-history-using-powershell

    Checking the WUA history might give you better results.

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, November 7, 2019 8:54 AM
  • Thanks both for your answer.

    This is a sample of my issue

    InstalledOn for the second line is empty.

    If I do (get-hotfix KB2894856).properties I can see it :

    I don't know why it's not shown...

    I'm going to test script with WUA to see the result


    Merci de marquer comme reponses les interventions qui vous ont ete utile.

    Tuesday, November 12, 2019 11:23 AM
  • Many updates do not have that property. That is just how Windows works.


    \_(ツ)_/

    Tuesday, November 12, 2019 5:26 PM
  • Sorry I failed on my last message.

    If I do with get-hotfix alone, installedOn is empty


    If I do with properties, it's not empty (and for none of the update)


    How can I find value propertie directly from get-hotfix?

    I find only this to get the last date : ((get-hotfix).properties | where {$_.name -eq "installedon"}).value | sort-object -Descending -Unique | select -first 1



    Merci de marquer comme reponses les interventions qui vous ont ete utile.


    • Edited by matteu31400 Tuesday, November 12, 2019 7:24 PM
    Tuesday, November 12, 2019 7:22 PM
  • Some are empty and some are not. Explicitly select the property.

    The KB you selected has a date in both pictures.  Pick one that is missing the date.


    \_(ツ)_/

    Tuesday, November 12, 2019 8:08 PM
  • I think you should look again my picture ^^

    There is no date when I do only get-hotfix for this KB ^^

    But there is when I read on properties.


    Merci de marquer comme reponses les interventions qui vous ont ete utile.

    Tuesday, November 12, 2019 8:41 PM
  • Get-Hotfix KB29959936 | select installedon


    \_(ツ)_/

    Tuesday, November 12, 2019 9:07 PM
  • Maybe I don't speak enough well english because you didn't understand me.

    Now you should be able to ^^

    Get-hotfix alone doesn't give me any information about installedOn.

    BUT if I use the same command line with properties and condition on installedOn, I have the date.


    Merci de marquer comme reponses les interventions qui vous ont ete utile.

    Wednesday, November 13, 2019 7:19 AM
  • Are you running as an admin at an elevated prompt?


    \_(ツ)_/

    Wednesday, November 13, 2019 7:27 AM
  • You can also try this:

    Get-CimInstance Win32_QuickFixEngineering


    \_(ツ)_/

    Wednesday, November 13, 2019 7:30 AM
  • It's not ok

    So, I think I find solution with my previous command  to know the date of the last installed update :

    ((get-hotfix).properties | where {$_.name -eq "installedon"}).value | sort-object -Descending | select -first 1


    Merci de marquer comme reponses les interventions qui vous ont ete utile.

    Wednesday, November 13, 2019 5:12 PM