Hardcore PowerShell Helper

I'm accustomed to using the Help (or Man) command to obtain help on PowerShell. Technically, these ARE commands - not aliases (you'll see Help if you run Dir Function:, and Man is an alias to help). They bundle up some functionality, like paginating the output, and leverage the native Get-Help cmdlet under the hood. But there can be some significant advantages in knowing the options for using Get-Help directly.

Don Jones

August 2, 2010

2 Min Read
ITPro Today logo

I'm accustomed to using the Help (or Man) command to obtain help on PowerShell. Technically, these ARE commands - not aliases (you'll see Help if you run Dir Function:, and Man is an alias to help). They bundle up some functionality, like paginating the output, and leverage the native Get-Help cmdlet under the hood. But there can be some significant advantages in knowing the options for using Get-Help directly.


First of all, never forget that Get-Help supports parameters like -Full and -Online, which display complete help and the online (and likely more up-to-date and correct) versions of the help. You can also add -Examples to see examples of how to use a command. The -name parameter specifies what you want help for, and it accepts wildcards - making commands like this valid:


Get-Help -name *service*

Get-Help *event*

Get-Help *log*


But you can restrict the help that comes back by using the -Category parameter, specifying Alias, Cmdlet, Provider, or HelpFile. For example, to just focus on the help content related to concepts and techniques, you want HelpFile:


Get-Help -name *param* -category helpful


You can also get help for a specific parameter. This can be incredibly useful. For example, New-ADUser (part of the ActiveDirectory module included with Windows Server 2008 R2) has a crazy number of parameters. When I want to look up a specific one, having to use the -full parameter and scroll through pages of output is time-consuming. Instead, I can just grab the parameter I want:


Get-Help -name New-ADUser -parameter Name


That accepts wildcards, too, so you can provide something like "-parameter *n*" to get all the parameters containing the letter "n," if that's what you were after. It can be a good way to quickly locate a parameter that you know exists, but that you're not sure of the exact name for.


You can use all of these with the shorter "help" command - no need to type the extra four characters for "Get-Help." But it's useful to know about all of the underlying function that the command supports.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like