PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

image rotation

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Scripts

11-20-2014 - Are my servers online?
11-11-2014 - scope
11-06-2014 - uptime via kernel

Latest Announcements/Events

10-31-2014 - Using PowerShell to download Teched Europe 2014 content
10-15-2014 - Class Dismissed
10-12-2014 - The Case for PowerShell

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

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 = "http://www.computerperformance.co.uk/Logon/code/code_$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!

Copyright 2012 PowerShell.com. All rights reserved.