query on update

Rising Flight 6,176 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.

Microsoft Security | Intune | Configuration Manager | Updates
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. AllenLiu-MSFT 49,436 Reputation points Microsoft External Staff
    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. Anonymous
    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

Your answer

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