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.
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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.
Features and Use-Cases:
‘PSDecode’ module provides below 4 of 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
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 –
- Import / Query All Windows System Error Codes for Description
- Query HTTP Status Code detailed information using Powershell
- Get-MACVendor using Powershell
- Query Port Information using Powershell
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! 😉
Prateek Singh
Related posts
1 Comment
Leave a ReplyCancel reply
Categories
Author of Books
Awards
Open Sourced Projects
Author at
Blog Roll
Mike F RobbinsDamien Van Robaeys
Stéphane van Gulick
Kevin Marquette
Adam Bertram
Stephanos Constantinou
Francois-Xavier Cat
Ravikanth Chaganti
Roman Levchenko
Blog Stats
- 1,132,217 People Reached
[…] you liked it, do check out PSDecode Module which is PowerShell based module that can decode System Errors, Exit codes, port numbers, HTTP […]