List of content you will read in this article:
The graphical user interfaces offered by most operating systems are a great way for regular users to navigate and control their devices. For professional users, however, this method could be slow and tedious, thus many gravitate towards using command-line interfaces to speed up their daily tasks.
Additionally, many of the tasks tech professionals have to carry out are quite repetitive and can take up a lot of time. Therefore, automation is a godsend for them. This is where PowerShell, Microsoft’s shell, and scripting language comes into play.
What is PowerShell?
Before diving into PowerShell itself, we should first form a better understanding of what a shell is. In IT, a shell is a user interface that allows you to access different operating system services. It can be both, command-line and have a graphical user interface.
Now, we can efficiently define Windows PowerShell. It is a shell developed by Microsoft to easily manage your system configuration and automate certain tasks. Despite being designed primarily with Windows OS in mind, it is also available for Linux and macOS operating systems. It is based on the .NET framework and is a command-line shell.
The Get–Help Command
Get-Help command is one of the most useful commands in PowerShell. It helps you to get to know all the commands and understand their structure.
The following are some of the cool features that Microsoft has added to this command:
- Display the complete structure of the command
- View all parameters and switches of a command
- Multiple Allies which apply to a command
- Display sample of command for executing it
To use the Get-Help
command for the first time, you have to enter this command once, so PowerShell can download commands help instructions and resources online.
After entering this command in PowerShell, you will see the output as follows:
Enter Y letter to download resources.
Alternatively, you can also update the Help files on your system using:
Update-help
Now that you have all the necessary resources, here is the syntax you should follow.
Get-Help [[-name] string] [-component string[]] [-functionality string[]] [-role string[]] [-category string[]] [ {-full | -detailed | -examples | -parameter string}] [-Online] [-ShowWindow] [-Path string]
This might be a little confusing, so here’s a breakdown of what all the different things mean:
-name
Request help about string. A cmdlet name, topic, alias, script, or function name. Wildcards are permitted. For Example, -name Get-Member, -name "About_Object", -name "ls". The "-Name" is optional.
-category
Display help for items in the specified category.
Valid values: Alias, Cmdlet, Provider, General, FAQ, Glossary, HelpFile, ScriptCommand, Function Filter, ExternalScript, All, DefaultHelp, Workflow, DscResource, Class, Configuration
Conceptual topics are in the HelpFile category.
-component
Display a list of cmdlets with the specified component value, such as "Exchange."
-detailed
Display additional information about a cmdlet, including descriptions of the parameters and examples of using the cmdlet. This parameter has no effect on displays of conceptual ("About_") help.
-examples
Display examples of using the cmdlet. To display only the examples, type "(get-help cmdlet-name).examples".
-full
Display the entire help file for a cmdlet, including technical information about the parameters. This parameter has no effect on displays of conceptual ("About_") help.
-functionality
Display help for cmdlets with the specified functionality. Wildcards are permitted.
-Online
Display the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. See Help about_Comment_Based_Help
-parameter
Display a detailed description of the specified parameter. These descriptions are included in the Full view of help. Wildcards are permitted.
-Path string
Get help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter is effective only for help with a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. Go to the provider path location and enter Get-Help or, from any path location, use Get-Help -Path. For more information, see about_Providers.
-role String
Display help customized for the specified user role. The role that the user plays in an organization. This parameter has no effect on the core cmdlets.
-ShowWindow
Display the help text in a popup GUI window. (PowerShell 3.0+)
Even with the key provided above, it might still be slightly difficult to understand, so here are some examples to clear things up.
Firstly, let’s say that we want to know what does ghy
do, thus we write:
Get-help ghy
Great, we now know that it gets a list of commands entered during the current session. Now, we would like to find out what the –count
parameter does. Therefore, we can write this:
Get-help ghy -parameter count
Ok, but what if you want to see some examples of the ghy
command to better understand it? Here’s how you can do that:
Get-help ghy -examples
As you can see, with the Get-Help command, you can find just about everything in regards to cmdlets and their parameters without even having to look up any documentation.
Conclusion
With the help of the Get-Help command, you are able to find many useful things about all the different cmdlets that you could use in PowerShell. Want to know the syntax of a certain command? See some examples of the cmdlet in action? Find out its different parameters? All that and much more can be done with the Get-Help cmdlet. We hope that this comprehensive tutorial has helped you in understanding the Get-Help command and how to use it. If you have any questions or suggestions, please leave them in the comment section below.