Get Last Update Installed

Handian Sudianto 5,001 Reputation points
2024-07-16T06:16:01.5766667+00:00

Hello,

It's possible to get last update install date using powershell?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,191 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,544 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Hania Lian 17,026 Reputation points Microsoft Vendor
    2024-07-16T06:29:22.7333333+00:00

    Hello,

    Yes, it is possible to get the last update install date using PowerShell. You can use the Get-HotFix cmdlet to retrieve information about installed hotfixes, including the installation date . Here's an example of how you can use it:

    Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 1

    This command will return the most recent hotfix installed on the system, including the installation date.

    More details you can refer to this link:

    https://stackoverflow.com/questions/33732541/powershell-how-to-get-date-of-last-windows-update-install-or-at-least-checked-f

    Best Regards,

    Hania Lian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. Castorix31 85,701 Reputation points
    2024-07-16T14:25:18.0933333+00:00

    You can use the method from ChatGPT :

    $updateSession = New-Object -ComObject Microsoft.Update.Session; $updateSearcher = $updateSession.CreateUpdateSearcher(); $historyCount = $updateSearcher.GetTotalHistoryCount(); $updates = $updateSearcher.QueryHistory(0, $historyCount) | Where-Object { $_.ResultCode -eq 2 } | Sort-Object -Property Date -Descending | Select-Object -First 1; if ($updates) { "Last Update Installed on: $($updates.Date)"; "Update Title: $($updates.Title)" } else { Write-Output "No updates found in the history." }
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.