Get Help on a Command

1. Problem

You want to learn about how a specific command works and how to use it.

2. Solution

The command that provides help and usage information about a command is called Get-Help. It supports several different views of the help information, depending on your needs.

To get the summary of help information for a specific command, provide the command’s name as an argument to the Get-Help cmdlet. This primarily includes its synopsis, syntax, and detailed description:

        Get-Help CommandName

or

        CommandName -?

To get the detailed help information for a specific command, supply the–Detailed flag to the Get-Help cmdlet. In addition to the summary view, this also includes its parameter descriptions and examples:

        Get-Help CommandName -Detailed

To get the full help information for a specific command, supply the–Full flag to the Get-Help cmdlet. In addition to the detailed view, this also includes its full parameter descriptions and additional notes:

        Get-Help CommandName -Full

To get only the examples for a specific command, supply the–Examples flag to the Get-Help cmdlet:

        Get-Help CommandName -Examples


3. Discussion

The Get-Help cmdlet is the primary way to interact with the help system in PowerShell. Like the Get-Command cmdlet, the Get-Help cmdlet supports wildcards. If you want to list all commands that match a certain pattern (for example, *process*), you can simply type Get-Help *process*.

To generate a list of all cmdlets along with a brief synopsis, run the following command:

        Get-Help * | Select-Object Name,Synopsis | Format-Table -Auto

If the pattern matches only a single command, PowerShell displays the help for that command. Although wildcarding is a helpful way to search PowerShell help, see Section 1.6, “Program: Search Help for Text” for a script that lets you search the help content for a specified pattern.

The Get-Help cmdlet is one of the three commands you will use most commonly as you explore Windows PowerShell. The other two commands are Get-Command and Get-Member.

For more information about the Get-Help cmdlet, type Get-Help Get-Help.

Tags: , , , , , ,