There are multiple ways to check for applied updates. Which is the correct method?

kidokidofire 11 Reputation points
2022-03-07T07:17:49.473+00:00

I would like to check for updates that have been applied to Windows, but from my research it appears that there are multiple ways to do this.
I have found that the results may differ depending on the method used, so I was wondering if you could tell me which method is appropriate.

a. Run the systeminfo command at the command prompt and check the results.
b. Go to Control Panel > Programs and Features > Installed Updates.
c. Check using the Windows Update Agent API.
 Example) Execute the following in PowerShell
  > $Session = New-Object -ComObject Microsoft.Update.
  > $Searcher = $Session.CreateUpdateSearcher()
  > $Res = $Searcher.search("IsInstalled=1 and RebootRequired=0 and Type='Software'")
  > $Res.Updates

Example of trial results (operating environment: Windows Server 2019 Datacenter)

a. b.
KB4601558
KB4470502
KB4470788
KB4480056
KB4493510
KB4494174
KB4499728
KB4504369
KB4512577
KB4512937
KB4521862
KB4523204
KB4535680
KB4539571
KB4549947
KB4558997
KB4562562
KB4566424
KB4570332
KB4577586
KB4577667
KB4580325
KB4587735
KB4589208
KB4598480
KB4601393
KB5000859
KB5000822


c.
KB4052623
KB4535680
KB4577586
KB4589208
KB5001879
KB4052623
KB2267602

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,289 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Rita Hu -MSFT 9,626 Reputation points
    2022-03-08T02:46:33.503+00:00

    @kidokidofire
    Thanks for your posting on Q&A.

    In fact, there are so many methods we could refer to get the installed updates list. As you mentioned above, method a and b are good ways to list the installed updates. There are no so called correct method. We could also run the get-hotfix command to get the installed updates list on PowerShell.

    I suspect that the method filter out the several installed updates according to the conditions. So there are only some of them. I'm not a expert in PowerShell. But it seems that the command in method c filter out the installed updates by $Res = $Searcher.search("IsInstalled=1 and RebootRequired=0 and Type='Software'").

    So it is recommend to follow method a and b to the installed updates list. We could also run the get-hotfix command to get the installed updates.

    Hope the above will be helpful.

    Have a great day.

    Regards,
    Rita


    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 "Comment".
    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.

    2 people found this answer helpful.

  2. Docs 15,151 Reputation points
    2022-03-11T06:52:52.383+00:00

    Some additional methods:

    Administrative Powershell:

    Dism /online /get-packages

    Wmic qfe list

    Get-windowsupdatelog

    Win + r > type: appwiz.cpl > once control panel opens view the left pane > click view installed updates

    .
    .
    .
    .
    .

    Please remember to vote and to mark the replies as answers if they help.

    On the bottom of each post there is:

    Propose as answer = answered the question

    On the left side of each post there is /\ with a number: click = a helpful post
    .
    .
    .
    .
    .

    0 comments No comments

  3. Rita Hu -MSFT 9,626 Reputation points
    2022-03-22T07:07:51.347+00:00

    Hello kidokidofire,

    Thanks very much for your time to follow this case. Here's a short summary for the problem , this will help other users to search for useful information more quickly.

    Problem/Symptom:
    The best ways to check for applied updates

    Solution/Workaround:

    1. Run the systeminfo command at the command prompt and check the results
    2. Go to Control Panel > Programs and Features > Installed Updates.
    3. Run the get-hotfix command in PowerShell

    Best regards,
    Rita


    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 "Comment".
    **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.**e

    0 comments No comments

  4. Tarcisio Miranda 0 Reputation points
    2023-06-29T02:56:40.2933333+00:00

    Try to run it this way it might work for rolling type updates and others:

    $Session = New-Object -ComObject Microsoft.Update.Session
    $Searcher = $Session.CreateUpdateSearcher()
    $Res = $Searcher.search("IsInstalled=1 and RebootRequired=0 and Type='Software'")
    foreach ($Update in $Res.Updates) { $Update | ConvertTo-Json }
    For all KBs that are installed:
    

    For all KBs that are installed:

    if (Get-Command ConvertTo-Json -ErrorAction SilentlyContinue) { 
        chcp 65001 > NULL 2>&1; mkdir C:\\temp\\scripts\\ > NULL 2>&1;
        $Session = New-Object -ComObject "Microsoft.Update.Session";
        $Searcher = $Session.CreateUpdateSearcher();
        $historyCount = $Searcher.GetTotalHistoryCount();
        if ($historyCount -gt 0) { 
            $Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Date, @{name="Operation";
            expression={switch($_.operation){
            1 {"Installation"};
            2 {"Uninstallation"};
            3 {"Other"}}}} | ConvertTo-Json -Compress | Out-File C:\\temp\\scripts\\getkbs.json -Encoding utf8 | Set-Content -Encoding UTF8 C:\\temp\\scripts\\getkbs.json;
            Get-Content C:\\temp\\scripts\\getkbs.json 
        } else {
            Write-Host "no_update_installed" };
        } else {
            Write-Host "no_json_module"
        }
    
    0 comments No comments