Prof. Powershell
Help Is On The Way
Need PowerShell help? It's a few keystrokes away.
- By Jeffery Hicks
- 02/27/2008
One terrific PowerShell feature is how easy it is to get help. The PowerShell team has done a pretty good job of providing online documentation. Want to know how to use the Get-Service cmdlet? Simply type:
Help get-service
By default, you get a brief summary of the cmdlet and its syntax. Want to know a bit more about the parameters? Try this:
Help get-service -detailed
To get the full rundown on the cmdlet and its parameters you can run:
Help get-service -full
As you look at the output, you'll see some examples of how to use the cmdlet. Almost all cmdlets offer some rudimentary example, so you can see how it is used. Sometimes, all you want to see are the examples, in which case this expression suffices:
Help get-service -examples
Because PowerShell only needs enough of the parameter name to distinguish it from any other parameter you can save a few keystrokes:
Help get-service -ex
Speaking of saving keystrokes, you don't have to ask for help by cmdlet name. If all you know is the alias, such as DIR, you can ask for help like this:
Help dir -full
The first thing you should notice is that you get help for Get-ChildItem, which is the cmdlet that is executed when you use DIR. You can continue to use DIR, just don't forget to use the parameters from Get-Childitem if you need to customize the cmdlet's execution.
Finally, PowerShell also includes a number of About files. These files provide a short summary, often with examples, of how to use different PowerShell features. At a PowerShell prompt, type:
Help about*
You should get a list of available "about" help files. If you see a topic that interests you, run help for that topic:
Help about_scope
As you looked at the list you probably noticed that some topic titles are a bit long. Fortunately, you only have to type enough of the name to uniquely identify it. Thus you could save a few keystrokes by typing:
Help about_sco
If you there is more than one possible match, PowerShell will display a list and you can refine your expression. Don't forget you can also use wildcards:
Help about *ex*
Finally, to see all the things that help can tell you about simply type Help. How easy is that?!
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 Petri.com, and a frequent speaker at technology conferences and user groups.