PowerShell : Import / Query All Windows System Error Codes for Description

Hey there!

We often come across Error codes (or Exit Codes) in windows operating system environment, but most of the time we’re unsure what these numerical values actually mean, unless we try Googling it out the number.


The Exit code or Return code or System Error code of a process in computer programming is a small number passed from a child process (or CALLEE) to a parent process (or CALLER) when it has finished executing a specific procedure or delegated task.

Windows uses 32-bit signed integers as exit codes.If a process fails initialization, a Windows system error code may be returned

So, in order to decipher these numbers,  I wrote two PowerShell functions  –

  1. Import-WindowsErrorCode : To import all these error Code information from series of MSDN URL’s mention HERE
  2. Get-WindowsErrorCodeInfo : To query the information of a specific Error Code from imported data..


  1. Quickly lookup for Error description depending upon the Windows Error Code/ Exit Code passed.
  2. Adding some verbosity to plain simple Error/Exit Codes.
  3. Could be utilized for a better Error Handling and better Investigation and Analysis.

Like in the below screenshot I passed the exit code returned while installing a .MSI file to the function Get-WindowsErrorCodeInfo to get information like ErrorString, Description and corresponding Hexa-Decimal value


Similarly, more information can be queried from the Error codes generated by running .exe or .MSU files, like in below image.




Run the below mentioned function from a Powershell console and it will make web Queries to Microsoft MSDN Web sites to capture all error codes, like in the following screenshot.

Its nothing but a series of Invoke-WebRequest’s on MSDN URL’s to web scrap the error code information, Sort them and make them in presentable format, which could be easily parsed.


Now you can either convert and Save the results locally in a JSON file (You can also choose CSV) ,

Or, convert it to JSON , then COPY the result


and upload it to your Github Gist.



Get the script from HERE on my Github Repository and you can run the Import-WindowsErrorCode function to save the information and then Get-WindowsErrorCode to query the error codes.

Following are some ways to Query information using the Error/Exit Codes

  1. You can query single exit code or can pass multiple value through Pipeline.
    By default it queries my Github Gist available over internet.
  2. You can also query the exit code information from a local JSON file.
  3. Or you can dump the JSON data on your Github Gist and retrieve the exit code information like below, by passing your URL under -GitHubJSONUrl switch
  4. In case you don’t mention any specific exit code or path; The function will return all exit code available from my Github gist, which I would advise to be the preferable method. Which will fetch around 2700 Exit Codes2764


You can skip the importing part and directly use the Get-WindowsErrorCodeInfo function which will query my Github gist URL by default ( but Requires Internet Connectivity).

I’ve taken care of the importing part for you guys 🙂 by importing and saving the all Windows System Error codes on my public Github gist.

Updated on 21 July  :

From few comments on Reddit link sharing, I’ve learned that this may not be the smartest way to get the error code description. You can also use windows Native command (Net Helpmsg Errorcode) to get the description which uses native windows API to get this information.


but after some hit and trial I’ve found that this approach has some limitations and doesn’t identifies every exit code we fetched form Microsoft websites. Like in the example in following screenshot for ERROR_INTERNET_* type error messages


I think both approaches are good and there is a trade-off between Speed and More information. Choice is yours!


Hoping you find it useful in your day to day work, comment and let me know for any improvements! Happy Learning 🙂





7 thoughts on “PowerShell : Import / Query All Windows System Error Codes for Description

  1. Skype has established its web-dependent consumer beta on the entire world, right
    after starting it generally in the Usa and You.K.
    earlier this month. Skype for Internet also now facilitates Linux and Chromebook for immediate online messaging communication (no voice and
    video but, all those call for a plug-in installment).

    The increase of your beta contributes help for a longer selection of languages to aid bolster that global user friendliness


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s