How to use PowerShell Command Help?

When working with PowerShell, you can use a lot of cmdlets (commands). Each cmdlet has its own parameters that you can use, but how do you know which ones they are? This is where the help command comes in.

The Get-Help cmdlet in PowerShell allows you to view the help information of a cmdlet, whether it’s a built-in cmdlet or a third-party one. The help information often also includes examples on how to use the cmdlet.

In this article, I will show you how to use the PowerShell command help.

PowerShell Help Command

The Get-Help cmdlet is, together with the Get-Command cmdlet, one of the most important cmdlets to master in PowerShell. It allows you to discover and learn how to use cmdlets in PowerShell without leaving your terminal.

When using the Get-Help cmdlet without any parameters, it will return the basic help information of the cmdlet. This includes the following information:

  • Synopsis – Short description of the function of the cmdlet
  • Syntax – Available parameters and how they are used together
  • Description – Full description of the cmdlet
  • Related Links – Provides a link to an online resource with more information and lists other related cmdlets

For the example in this article, I am going to use Get-ChildItem cmdlet. This cmdlet gets items, like files and folders, from the specified location.

Get-Help Get-ChildItem
PowerShell Get Help Command

Now, when you run the Get-Help cmdlet for the first time, you will probably get a message asking if you want to run Update-Help. The help content of the built-in cmdlets is not preinstalled on your system, so before we can use it, we will need to download the help information.

Just press Y to download the help files.

Now, before we go into more detail on how to use the help command in PowerShell, here is a quick overview of the most important information:

  • Get-Help Get-Process : Displays help about the Get-Process cmdlet.
  • Get-Help Get-Process -Examples: Displayed example for the Get-Process cmdlet.
  • Get-Help Get-Process -Online : Opens online help for the Get-Process cmdlet.
  • Help Get-Process : Displays help about Get-Process one page at a time.
  • Get-Process -? : Displays help about the Get-Process cmdlet.

Get-Help vs Help

Besides the Get-Help cmdlet, we also have the Help command in PowerShell. The Help is almost identical to the Get-Help cmdlet, but with the difference that it returns the full help documentation one page at a time.

This means that you will have to press the spacebar to view the next page of the help information. If you have found what you are looking for, you can press Q or Ctrl + C to exit the help information.

Getting Examples

Now, the default output of the Get-Help cmdlet can be a bit overwhelming. You get all the information about the cmdlet, making it harder to find what you are looking for.

One of the most powerful and helpful information that the help command can return are the examples of a cmdlet. Examples often give you a quick understanding of how to use the cmdlet.

To view the example, we can use the -examples parameter. For example, if we want to view the examples of the Get-ChildItem cmdlet, we can do:

Get-Help Get-ChildItem -Examples
help command powershell

Specific Parameter Help

Instead of viewing all the help documentation of a cmdlet, we can also look up specific information about a single or multiple parameters of a cmdlet. The parameter help will not only return information on what the parameter does but also:

  • Required – If a parameter is required for the cmdlet
  • Position – Position of the parameter
  • Default value
  • Accept pipeline input – When True, which value it requires
  • Aliases – Aliases that you can use instead of the cmdlet name
  • Accepts wildcard characters

A good example of this is the Get-Service cmdlet. If we look up the name parameter of this cmdlet, we can see that the position of the parameter is 0, meaning that we don’t need to use the parameter name to look up a service.

 Get-Help Get-Service -Parameter name
get-help

You can get the help information of multiple parameters by simply separating them with a comma, like this: Get-Help Get-Service -Parameter Name,DependentServices

Full and Detailed information

We can also view the complete help information by using either the Full or Detailed parameter. Now, when looking at the results of the two parameters, the output might look the same at first glance, but there is a difference between the two.

# View detailed information
Get-Help Get-ChildItem -Detailed

# View full help information
Get-Help Get-ChildItem -Full

The detailed output lacks all the technical details of the parameters, like if they are required or not. It also doesn’t show the input and output information of the cmdlet.

When using the Full parameter, you will get the complete help information.

Reading the Online Help information

If you don’t like reading the help information in the terminal, you can also open the online documentation in your browser. To do this, you will need to add the parameter -Online.

This will open the official documentation of the cmdlet. You can also view the URL that it will open in the related links section of the help information.

Using Wildcard with Get-Help

If you don’t know the exact cmdlet name that you want to look up the help information for, then you can also use wildcards. The Get-Help cmdlet will then return a list of all cmdlets that match the search query.

Now you don’t need to use the wildcard (*) characters. If the Get-Help cmdlet can’t find a command, it will search for any command with the name in it. So the below commands will give the same results:

# Using the wildcard characters
Get-Help *VPN*

# Or directly
Get-Help VPN

Other common formats to use for looking up cmdlets are:

# Get all cmdlets that end with -VPN
Get-Help *-VPN

# Get all cmdlets that start with Get-VPN
Get-Help Get-VPN*

Getting Specific Information Only

The Get-Help cmdlet is a bit all or nothing when it comes to returning information. We can lookup the information of a single or multiple parameters, but to do so, we will need to specify which parameters we want to see.

But what if you don’t know the exact parameter names? Or what if you only want to read the description or the output results of a cmdlet?

The result of the Get-Help cmdlet is just an object. This means that we can select which information we want to see with the help of Select-Object and -ExpandProperty. So if you want to view all parameters of the cmdlet and their descriptions, we can do:

Get-Help Get-Process | Select -ExpandProperty Parameters
cmdlet help information

Wrapping Up

PowerShell is constantly changing; new modules are added, and some are updated or replaced. This means that you can’t know all the options, so therefore, it’s important that you know how to easily look up the documentation of a cmdlet.

Hope you liked this article, make sure to subscribe to the newsletter if you want to learn more about PowerShell. If you have any questions, just drop a comment below.

Enjoying the article but hate the ads? Join the Insiders for a clean, ad-free experience ($1), or go Elite ($3) to get priority answers and more.

Join LazyAdmin

Enjoying the article but hate the ads? Join the Insiders for a clean, ad-free experience ($1), or go Elite ($3) to get priority answers and more.

Join LazyAdmin

Leave a Comment