query on update

Rising Flight 3,891 Reputation points
2023-04-16T00:32:43.2666667+00:00

Hi All I want to know whether an hotfix is installed on the VM from powershell. if it is installed is it failed or success and when is it installed. please help me with powershell syntax.

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,499 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,400 questions
Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,538 questions
Microsoft Configuration Manager Updates
Microsoft Configuration Manager Updates
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Updates: Broadly released fixes addressing specific issue(s) or related bug(s). Updates may also include new or modified features (i.e. changing default behavior).
977 questions
0 comments No comments
{count} votes

Accepted answer
  1. AllenLiu-MSFT 41,136 Reputation points Microsoft Vendor
    2023-04-17T05:44:39.6033333+00:00

    Hi, @Rising Flight

    Thank you for posting in Microsoft Q&A forum.

    We can use the powershell syntax like: Get-HotFix -ID KB5012170

    1


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".


1 additional answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 31,016 Reputation points Microsoft Vendor
    2023-04-17T02:23:51.36+00:00

    Hi, You can get the Windows Updates like below and check if the update is in the list.

    $Session = New-Object -ComObject "Microsoft.Update.Session"
    $Searcher = $Session.CreateUpdateSearcher()
    $historyCount = $Searcher.GetTotalHistoryCount()
    $Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date,
        @{name="Operation"; expression={switch($_.operation){
            1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}
    }}}
    

    https://social.technet.microsoft.com/wiki/contents/articles/4197.windows-how-to-list-all-of-the-windows-and-software-updates-applied-to-a-computer.aspx

    Best Regards,

    Ian Xue


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments