Skip to main content

Looking Up Cryptic Error Codes

All PowerShell versions

Often, WMI and API calls return cryptic numeric error codes. To find out what went wrong, try this little helper function:

function Get-HelpForErrorCode([String]$Code)
  if ($Code.StartsWith('-'))
    $Code = '{0:X8}' -f ([Int32]$Code)
  $url = "$Code.htm"
  Start-Process -FilePath $url

You can submit any decimal or hexadecimal error code, and the function opens the appropriate web page where the error is explained (if information is available):

PS> Get-HelpForErrorCode -2146828235

The website will display information similar to this:

Twitter This Tip! ReTweet this Tip!

Nov 21 2014, 06:00 AM


I am the one