PowerShell Genie

Get-Help tutorial: read syntax and examples

Get-Help is the built-in documentation reader, and the fastest way out of being stuck. Called with a command name it prints a summary, the syntax, and a description of what the command does.

Lesson 3 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Overview

The switches are what make it useful. -Examples prints just the worked examples, which is usually what you actually wanted. -Full prints everything including per-parameter detail. -Parameter followed by a parameter name explains one parameter without printing the other forty. -Online opens the current Microsoft Learn page in a browser, which is the most reliable option because it cannot be out of date.

On Windows PowerShell 5.1 the help files are not installed by default, so Get-Help shows only a stub until you run Update-Help once as administrator. PowerShell 7 falls back to online content instead, which is less of a trap.

Get-Help also reads conceptual topics as well as commands. Get-Help about_Pipelines and the other about_ topics are the closest thing PowerShell has to a built-in manual.

Inspect this example’s structure

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-Help Get-ChildItem -Examples
  1. Stage 1Get-Help-Examples

    What happens

    This asks for the examples section of the Get-ChildItem help topic and nothing else. You get a handful of real commands with a line of explanation each. When you are learning a new command, this is almost always the right place to start, because the examples show the parameter combinations people actually use.

    Worth remembering

    • Get-Help <name> -Examples is the highest-value form.
    • -Online opens the current page and cannot be stale.
    • Run Update-Help once on Windows PowerShell 5.1.
    • about_ topics cover concepts as well as commands.

    Check your understanding

    There is no runnable lab on this page — these run in your own terminal, so predict the answer first, then verify.

    Q1. You run Get-Help Get-Service -Examples. Do you get the full help text or just the examples?

    Answer: Just the EXAMPLES section — that is the point of the switch. The full text needs -Full, and everything is Get-Help Get-Service with no switch.

    Q2. You type Get-Help with no arguments at all. What happens?

    Answer: You get the help topic for Get-Help itself. A bare cmdlet name is always a valid help query.

    Q3. Get-Help Get-Service -Online opens something outside the terminal. What, and why is it useful?

    Answer: The current Microsoft Learn page for Get-Service in your browser — unlike the text on your machine, it can never be stale.

    Primary documentation

    Get-Help reference · Get-ChildItem reference

    Try it

    Illustrative output · values vary by environment

    1PS> Get-Help Get-ChildItem -Examples

    Example reader

    Inspect this page's example

    Fictional browser data when supported

    Run supported commands against the practice data, or inspect the example without executing it.

    Ready to inspect.

      Prints only the examples from the Get-ChildItem help topic.

      Show reference output

      Illustrative output · values vary by environment

      NAME
          Get-ChildItem
      
      SYNOPSIS
          Gets the items and child items in one or more specified locations.
      
      EXAMPLE
          PS> Get-ChildItem -Path C:\ -Recurse

      Practise this

      Read command help

      Read the syntax help for Get-Service.

      Review the lesson

      Keep going

      Next: Execution Policy
      Genie guideGet-Help tutorial: read syntax and examples

      Get-Help is the built-in documentation reader, and the fastest way out of being stuck. Called with a command name it prints a summary, the syntax, and a description of what the command does.