Quick Hits: Translate Windows Error Codes

Sometimes while working in Windows you might see some logs or receive an error message that are just numbers. Something like a 5 or maybe a 32. Regardless, these are nothing short of confusing and make you have to Google (or Bing) to find out what exactly that number means. Or maybe you have a crazy curiosity to see what numbers translate to a windows error… Either way, there is a .NET namespace that can answer all of those questions. That namespace is ComponentModel.Win32Exception.

Lets look at the error code 5.

[ComponentModel.Win32Exception]5

image

How about error code 32…

[ComponentModel.Win32Exception]32

image

One more, I have this error in my windowsupdate.log that I don’t feel like looking up online:

[ComponentModel.Win32Exception]0x800700de

image

Pretty cool, isn’t it?

Ok, so this isn’t groundbreaking, but it is just another cool thing that you can do with PowerShell.

For even more fun, you can run this to find all sorts of error codes:

1..1000 | % {"$($_): $((([ComponentModel.Win32Exception]$_) -split ": ")[1])"} | more

image

This shows error codes 614-662 and would continue on to 1000.

Feel free to take it beyond 1000 and see what other error codes there are to see.

About Boe Prox

Microsoft Cloud and Datacenter MVP working as a SQL DBA.
This entry was posted in scripts and tagged , , . Bookmark the permalink.

3 Responses to Quick Hits: Translate Windows Error Codes

  1. Pingback: Episode 152 – PrimalForms 2011 with Alex and David « PowerScripting Podcast

  2. Trevor Sullivan says:

    Nice article, bro — I like it a lot.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s