Windows Server How-To
Need Help with PowerShell?
Although PowerShell can be a bit intimidating at times, Microsoft has built in a comprehensive help system that should be able to assist you with most of your PowerShell related questions.
Anyone who has ever worked with PowerShell knows that PowerShell can be a little bit intimidating the first couple of times that you use it. While it might be tempting to try to avoid PowerShell, Microsoft's server products have become ever more PowerShell centric. In fact, you pretty much have to know PowerShell to be able to administer Microsoft Server products. That's the bad news. The good news is that Microsoft has made it as easy as possible to learn PowerShell. In fact, there are several mechanisms in place to help administrators. In this column, I will show you some of those mechanisms.
PowerShell actually has a fairly rich help system that can help you with command syntax and usage. In fact, if you enter Get-Help you will see a long description of how you can get help with various PowerShell cmdlets. You can see an example of this in figure 1.
Of course if you are having trouble getting a specific cmdlet to work, a generalized help screen probably won't help you all that much. So what do you do if you need more specific help?
The easiest way to get help using a specific cmdlet is to append the cmdlet to the Get-Help cmdlet. Suppose for instance that you needed help using the Get-Service cmdlet. In that type of situation, you could get the help that you need by entering Get-Help, followed by Get-Service. The full command would be:
As you can see in figure 2, this command provides you with the full syntax for the Get-Service cmdlet. I chose this particular cmdlet to demonstrate because it has a relatively simple syntax. However, Microsoft often includes usage examples within the help for some of the more complex cmdlets.
One thing that you do need to know about the PowerShell help system is that Microsoft is constantly working to improve it. It you attempt to get help for a particular cmdlet and the results end up being unsatisfactory then there is a reasonably good chance that better information is available. You can check to see if any updates to the help system exist by entering the Update-Help cmdlet. You can see this process in action in figure 3.
So far I have shown you how to get help for specific PowerShell cmdlets. However, the problem with Get-Help is that it is only effective if you know which cmdlet you need help with. Sometimes you may not know exactly which cmdlet to use.
Suppose for instance that you were trying to configure iSCSI using PowerShell. For the sake of demonstration, let's also assume that you know how iSCSI works and would have no trouble configuring it through a GUI, you just don't know how to do it through PowerShell. In this type of situation, the easiest way to get started is to type Get-Help followed by iSCSI. When you enter this command, PowerShell immediately picks up on the fact that you entered a single word rather than a cmdlet. That being the case, PowerShell displays every cmdlet that is related to iSCSI. As you look at figure 4, you can see that a number of different cmdlets and functions are displayed.
The technique that I just demonstrated is great if you are trying to determine which PowerShell cmdlets are available to help you with a particular task. However, the help system might not be all that helpful if you don't understand the basics of working with PowerShell. As you look at the figure, you will notice that there is a column named Module. If you didn't know what a PowerShell module was then your first instinct might be to use the Get-Help Modules command. However, this command only shows you what module related cmdlets are available. If your goal is to find out what modules are then you need contextual help. You can get this type of help by entering the Get-Help cmdlet, followed by About_ and the term that you want to get help on. In this particular case the command would be:
You can see a portion of the help that is provided in Figure 5. The information that is displayed actually extends far beyond the window's boundaries and is quite extensive in scope.
If you can't find the help that you need within PowerShell, try a Web search. Microsoft provides some really great online resources for those who are trying to learn PowerShell.
Brien Posey is a 19-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.