Adding Help to PowerShell Scripts

Recently I have started adding help to all of my PowerShell scripts, I do this for a few reasons. I hope (once I get better at scripting) that other people will use them and in order for others to understand what is going on in the script there needs to be help. It is best practice and makes the overall look and feel of the script much more professional and it comes in handy when I can’t quite remember what I did in a script when I was writing it, sure I could go through and work it out but the help feature makes it so much quicker.

I don’t put in incredibly detailed help information (I should and will eventually) and it is always evolving but at the moment I start off all scripts like this:

The help is easily accessed just as you would access the help in a Cmdlet. For example:

Get-Help 'C:\>Random-PowerShell-Script.ps1'

or

Get-Help 'C:\>Random-PowerShell-Script.ps1' -Examples

The only difference is that you need to provide the folder path and the full script name and not just the name of a Cmdlet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s