How to view windows update error codes in cmd or powershell

Dustin Jordan 5 Reputation points
2024-04-17T19:33:52.8333333+00:00

Trying to update windows PCs silently on powershell remotely and running into failed installs. Is there a way to view the error codes from cmd or powershell? Need the ones that show in the windows update gui

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,629 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,182 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,065 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Darrell Gorter 1,296 Reputation points
    2024-04-17T21:21:12.4166667+00:00

    Hello,

    You may want to try this tool.

    https://learn.microsoft.com/en-us/windows/win32/debug/system-error-code-lookup-tool

    Depending on what you are doing in the OS, the description may change per component, byt this is the underlying code. The component/Feature may have more specific wording that what is displayed here.

    Darrell

    0 comments No comments

  2. Dustin Jordan 5 Reputation points
    2024-04-17T21:25:40.3966667+00:00

    basically I am just running windows updates in powershell through an RMM tool and getting failed installs. I want to know why it is failing with an error code


  3. Hania Lian 8,106 Reputation points Microsoft Vendor
    2024-04-18T02:29:56.6066667+00:00

    Hello,

    Yes, you can view the error codes for failed Windows updates in PowerShell by following these steps:

    Open PowerShell as an administrator.

    Type the following command and press Enter: Get-WindowsUpdateLog

    This will generate a log file in the %windir%\WindowsUpdate.log location.

    Open the log file and search for the error codes associated with the failed updates. The error codes will be listed in the format of 0x########.

    You can also use the following PowerShell command to view the error codes for failed updates:

    Get-WindowsUpdate -History | Where-Object { $_.Update.State -eq 'Failed' } | Select-Object -Property Title,KB,SupportUrl,UpdateId,RevisionNumber,LastDeploymentChangeTime,State,FailureReason,ResultCode

    This command will display a list of failed updates along with their error codes.

    Best Regards,

    Hania Lian

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

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