Powershell Howto: Getting Help with Get-Help
Nothing fancy for today’s post.
With that said, however, we are going to be getting back to the basics!
Going to be talking about Powershell once again.
Though it may seem a simple thing, and people are often surprised to hear me say it, my single favorite cmdlet in Powershell is the Get-Help command.
Surprised? You shouldn’t be.
Those that have used Get-Help on a regular basis know that the Powershell help documentation is some of the most extensive documentation on any IT platform in the world.
Get-Help will make your life much easier. Today I’ll be showing you how to utilize this cmdlet a little more efficiently.
The general syntax for the command is simply:
Thus, if I want the help information on the Get-Counter command I would issue:
And I would be returned the below:
This gives us the usual detailed info, but there are situations where we need to view the help information and write out the syntax at the same time, so it’s helpful to have an option to separate out the help. We can do this by modifying the command a bit.
Get-Help -ShowWindow Get-Counter
This will pop out a nice help window that is searchable as seen below:
If you enjoy reading the help in a nicer format yet, you can always issue the -Online parameter as well, which will open the associated help in a web browser.
As this will link you to the associated TechNet article for the command, you’ll often find this to be the most current set of documentation for the associated command.
With that said, you can also pull down the latest Get-Help information from the net by issuing a simple Update-Help command.
Powershell will query the internet for updated help files and will download the needed items.
I personally recommend that this be completed monthly if you’re using Powershell frequently for system administration in your environment.
The other helpful tip of note is the ability to append the -examples, -detailed, or -full flags to the end of the command. This is done WITHOUT passing the -ShowWindow or -Online flags and will tell Get-Help to output additional detail on the command depending on the flag given.
As you can see below, I’ve passed the -examples flag. This will tell Get-Help to show me several syntax examples for various situations. This can be extremely helpful when it’s not readily apparent what the proper syntax or usage is.
So again, getting back to basics again this week, but there is something to be said for solid fundamentals.
Thanks for reading!