Get-Help

I thought I would spend some time on some beginner topics to help out people who may be new to Powershell.  The first few topics I will talk about will be items to help get you started and find more information as you go along.  I hope to bring people some new information that they may not have known or realized when they first looked at Powershell.

The first topic will be the Get-Help cmdlet that is available in all versions of Powershell.  To find out specifics in your version, you can use the following command:

Get-Help Get-Help

No, you are not seeing double.  I am actually having you use the Get-Help cmdlet on the Get-Help cmdlet.  I know, it seems like a strange joke, but it works.  As you will see in further examples, I fully qualify the parameter that is being used (in this case, it would be the -Name parameter).

The Get-Help cmdlet displays information from the help files in Powershell.  Not only can you find out about the cmdlets in Powershell, but you can also use it to find information on concepts in Powershell.  For example, you can use the following command:

Get-Help -Name about_*

You will get a list of topics that Powershell can do and how to accomplish some different types of tasks.  For instance, if you want to find out information about variable scopes in Powershell, you can use this:

Get-Help -name about_scopes

Some new things in Powershell version 3 is the ability to show the help in a different window.  Try this, for example:

Get-Help Get-Command -ShowWindow

You should see a new window popup that includes all the help information for the Get-Command cmdlet

Now, suppose you need help information on the New-Item cmdlet, but you just want to see how it might be used.  Instead of getting all the description information, you can just ask for the “examples” from the help information:

Get-Help -Name New-Item -Examples

Now you will see a list of all the examples for the help file.

One final note…if you are using Powershell version 3, you might fire up your console and find that you don’t have any help files available, or at the very least, minimal help files.  Don Jones has written a full explanation of why this happens here.  The quick answer is that the help files are no longer included as part of the core OS and can now be updated at will by using the Update-Help cmdlet.  When you use it, however, make sure to run the console as Administrator so that the files can be updated properly.

The last tidbit I will leave with you is to ALWAYS check the help files.  There have been many times that I have spent hours trying to figure something out and then smacked myself in the head for not looking the help where the answer was…plain as day.

Advertisements
This entry was posted in Beginner and tagged . Bookmark the permalink.