Introduction:

PowerShell based module that can decode System Errors, Exit codes, port numbers, HTTP Return codes and MAC Vendors. This module can be used to quick lookup Error descriptions.

To add verbosity to your custom error messages and for a better Error Handling, Investigation, and Analysis.

Technically the module offers a set of cmdlets that query a database of Error/Exit codes, port numbers, and MAC addresses which totals to 83049 individual records.

table

Error, Ports and HTTP Return Codes

In order to make it available to the community, I’ve wrapped this project as a module publically hosted on a Github repository where you can assist me to make it better.

github


Module Installation:

Installation of the module is pretty straightforward and you can utilize one of the below methods, depending upon the version of PowerShell on your machine.


# Installation on PowerShell v5 from Powershell Gallery
# [Recommended] Install to your personal PowerShell Modules folder
Install-Module PSDecode -scope CurrentUser
# [Requires Elevation] Install for Everyone (computer PowerShell Modules folder)
Install-Module PSDecode
# Installation PowerShell V4 and Earlier from Github repository
# To install to your personal modules folder run:
iex (new-object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/PrateekKumarSingh/PSDecode/master/Install.ps1')

In addition, you can also utilize aliases that come handy with this module.

Install

 


Features and Use-Cases:

‘PSDecode’ module provides below 4 of cmdlets

cmdlets

and could be useful in following use cases –

  • Decode Exit Codes and Windows System errors

  • List all ‘Listening’ ports and service name mapped to Ports with description

  • Identify MAC vendors for Network related troubleshooting

  • Adds verbosity to you HTTP web requests by decoding the HTTP Return Codes

    Using this Powershell module you can very easily decode any HTTP return code or status codes programmatically. In addition, you can provide a very detailed description in case of errors to add more verbosity to the program or application.

    Following example demonstrates how you can use Get-HTTPStatusCode cmdlet to get detailed description of the return codes like – 301, 404 and 202

HTTP Return Codes Decoded with PowerShell


Data Sources:

I scraped and collated all the Error codes, Exit codes, HTTP status codes, MAC Vendor and Port number registrations from various trustworthy websites over the internet. To know more how I did that, refer the following blog posts –


Hope you’ll find the script useful and Thanks for reading.

Please do follow me on twitter for more Interesting PowerShell material and don’t forget to share ‘PSDecode’ module with your colleagues and friends, Cheers! 😉

 

signature