Prof. Powershell

Can I Get a Little Help Here? The Get-Help Cmdlet

It happens to all of us: We forget things. Use the PowerShell Get-Help cmdlet to rejog your memory.

I've spent a number of columns recently on more advanced topics. But some of you may just be joining the class so I'm going to revisit some basic PowerShell concepts over the next few weeks. Even if you think you know the material I hope you'll take a few minutes because I may point out something you didn't realize existed. Even after all these years I still discover new nuggets of PowerShell goodness.

I think that PowerShell's help system is one of its greatest strengths. Everything is well documented and right at your fingertips. You can use the Get-Help cmdlet, or a built-in function, Help, on practically any topic or command. You can even use wildcards. Try this command:

PS C:\> help *WMI*

You get a number of items, any of which you can get help on:

PS C:\> help Register-WmiEvent

The initial help displayed is not everything. Remember you can use the -Full parameter:

PS C:\> help Register-WmiEvent -full

By the way, if you only want to see the examples use the -Examples parameter:

PS C:\> help Register-WmiEvent -examples

The full help can sometimes be overwhelming. There are some situations when all you want to see is help on a specific parameter. For example, the Register-WmiEvent cmdlet has a -Action parameter. But how do I use it? The Get-Help cmdlet, as well as the Help function, have a parameter called -Parameter. To retrieve help on the Action parameter, run this:

PS C:\> help Register-WmiEvent -Parameter Action

This should tell you everything you need to know. You can also use wildcards:

PS C:\> get-help Register-WmiEvent -Parameter *

When you use Get-Help, the output is an object which means you can get a little more granular. This won't work using the Help function. Pipe a parameter to Get-Member to see for yourself:

PS C:\> get-help Register-WmiEvent -Parameter action | get-member

This means I can run an expression like this:

PS C:\> get-help Register-WmiEvent -Parameter action | Select Name,Required,PipelineInput

Or extend this to all parameters and dive deep into the cmdlet:

PS C:\> get-help Register-WmiEvent -Parameter * | Sort Required | Select Name,Required,PipelineInput,ParameterValue

If you feel totally self-referential or introspective you should check out the help parameter itself:

PS C:\> help get-help -Parameter parameter

So don't stumble around aimlessly or be embarrassed to ask for directions. Get help and reach your destination.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular