How to use Help command in PowerShell?
While writing the script sometimes we need help related to commands like description, examples, or parameters. Many of us google the command and search for the various website related to help but the good news is we don’t need to go online to search for help and it can be found in the PowerShell system only.
Get-Help command
Get-Help or help (Alias) command is used to search for cmdlets related help in PowerShell. Microsoft releases updates on a regular basis for their cmdlets, you need to update the help using Update-Help if it is not updated lately and if you have installed PowerShell or Windows terminal recently which includes the PowerShell default.
Update-Help command will update each module installed in your system and this command downloads the help from Microsoft repository into your local system. You can also save the help or import them from another system but command help update related topic is covered in the different article. We will here focus on the current Get-Help command.
Get-Help command provides you everything that is available on the Microsoft portal for PowerShell cmdlets.
To search for the specific command help, you need to use command name with Get-Help (help) cmdlet.
Get-Help Get-Service
Once you run the above command, help related output like Name, Synopsis, Syntax, Description, Related Links etc.
Other than default help, there are other help related parameters to filter the specific help for the cmdlet.
1) -Detailed
2) -Examples
3) -Parameters
4) -Online
5) -ShowWindow
If you want to search the detailed help including Examples and Parameters, use -Detailed parameter in the help command.
Get-Help Get-Service -Detailed
To get the help with examples only, use -Examples parameter. This will provide few examples and their explanation.
Help Get-Process -Examples
To get the explanation of the parameters, use -Parameter. The below command will give all parameters related description and (*) will show all the available parameters in the command.
Help Get-Process -Parameter *
To get the specific parameter related help, use Parameter name instead of (*).
Help Get-Process -Parameter ComputerName
To get only If you want the Help output in the GUI window, use Show-Window command.
In the Settings button, you can filter our specific item.
Output:
You can also find the specific keyword in the search box and search the specific command related help on the internet, use -Online parameter. It will redirect you to the Microsoft documentation page.
Help Get-Process -Online