Getting help
One feature that stood out when Microsoft first unveiled Windows PowerShell was the built-in help system. PowerShell comes with a Get-Help
cmdlet. If you run it with no parameters, you can see a description of how to use the Get-Help
cmdlet. But if you use Get-Help
with the name of a cmdlet, you get help with that cmdlet. The built-in help system is invaluable, as it tells you what the cmdlet does, which inputs it takes, and what it outputs. With thousands of cmdlets to choose from, using Get-Help
is much simpler than trying to remember them all, as shown in the following screenshot:
Figure 2.10 – Using Get-Help
The help information quickly references what the cmdlet does and its calling syntax. You can also get examples and more detailed information, as shown in Figure 2.10.
You can also add help information to your scripts, which enables a script’s user to use Get-Help
and get details about the script. You achieve this by adding a special block of help text at the start of the script.
Another great feature of PowerShell’s help system is that you can update the help text. The PowerShell help system enables the authors of the various scripts and commands you use to update help text and place it online. Then you use the Update-Help
cmdlet to download the updates onto your system.
You may also note that there is very little help text the first time you use PowerShell. The reason for this is that PowerShell, by default, ships with minimal help text, which reduces the size of the PowerShell installation package. Once you first use any version of PowerShell on a system, you can download the most up-to-date help information, but only where you need it.
For more information on PowerShell’s help system, see https://packt.link/xL902.