PowerTip: Display Every PowerShell Example in Help

Summary: Display every Windows PowerShell example that Help contains.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display every Help example that Windows PowerShell contains?

Hey, Scripting Guy! Answer Use Get-Command to retrieve all of the cmdlet names, pipe the output to Foreach-Object,
           and call Get-Help with the –Example switch, for example:

gcm | % {get-help $_.name -ex}

Note  GCM is an alias for Get-Command and % is an alias for Foreach-Object.

Comments (2)

  1. roddie digital says:

    Why would you ever need or want to do this??

  2. Ed Wilson says:

    @roddie digital because the PowerShell examples are very good, and illustrate more than just specific cmdlet help, but instead often show how the different cmdlets work together. By looking at all the help examples, you have thousands of examples of excellent
    PowerShell commands and you can learn a lot about good PowerShell technique by studying these.

Skip to main content