There are no cmdlets more familiar to newcomers and experts alike than the PowerShell
Get-Help cmdlet. Due to PowerShell's integrated and updatable help system, the
Get-Help command is the way you discover what commands do, their parameters and even (hopefully) lots of useful examples of how to use the command.
Every cmdlet and function you come across is supposed to have help content built with it that the PowerShell cmdlet
Get-Help can read. I say "supposed to" because unfortunately, some authors don't include help content.
The most common use of the
Get-Help cmdlet is to use it to find help content for a particular command. For example, perhaps you've discovered a new command called
Get-Command cmdlet and want to know more information about it. You'd use the
Name parameter on
Get-Help. This would return a basic set of information about that command as you can see below.
You'll notice that although a lot of information is returned, it's just a summary of things you can do. And you'd never know that
Get-Help can return other types of help content too like examples.
Finding Parameter Information
You can drill down into the help content more a few different ways. One of those ways is finding information on a single parameter of a command. Perhaps in the example, I'm using here, I see a reference to a
Raw parameter and am not quite sure what that parameter does. I can use the
Parameter parameter on
Get-Help with the
Name parameter to return only information about that particular command parameter.
Get-Help and Examples
One of the best things about the PowerShell help system is that it has native support for examples. Examples are an excellent way to see, with context, how to use a particular command. If the command author added examples to their help content, you can see those examples by using the
Examples parameter. When you use this parameter,
Get-Help will return one or more examples of how that command is used in different circumstances.
Getting Verbose Help
Summaries, parameter information, and examples aren't the only information returned by
Get-Help. Sometimes, you need to see all information available for a cmdlet. In that case, you always have the
Full parameters available. Each of these parameters displays an increasing amount of information.
Detailed parameter adds parameter descriptions and examples to the primary help display. In essence, they combine using the
Examples parameter and will display information for all of the parameters as if you would have used the
Parameter parameter on all of the command parameters.
Detailed parameter isn't enough; you can always go the nuclear approach and return all of the help content with the
Full parameter. This parameter doesn't filter information at all. The
Fullparameter reads all of the help content defined for a particular command.
If you'd like a more graphical representation of the help, you can also use the
ShowWindow parameter. This parameter brings up a window that allows you to easily search the help content and only show certain areas via the Settings button. This view is helpful if you really want to go help content sleuthing.
There are a few other, less common parameters you can use with
Get-Help. If you're interested in learning more, you know how to find information on those additional parameters, right? Yup,
Get-Help can find help content on itself.
Get-Help command religiously when looking for more information about PowerShell commands. There's little need to go to Google when you have a powerful help system and a command to help you tap into it.
Subscribe to Adam the Automator
Get the latest posts delivered right to your inbox