Converting Error Numbers

by Nov 20, 2014

All PowerShell Versions

Error numbers that are returned by Windows API calls often appear as very large negative numbers. To give meaning to these numbers, convert them to hexadecimal values like this:

 
PS> $errornumber = -2146828235

PS> '0x{0:x}' -f $errornumber
0x800a0035 
 

To find out the reason for such an error, when you now search for the hexadecimal value, chances are much higher that you find a match.

Twitter This Tip! ReTweet this Tip!