Get Help - PowerShell
Overview
The Get-Help
command provides comprehensive information about PowerShell cmdlets, functions, scripts, and providers. It allows users to quickly access command documentation, syntax, and examples, making it an indispensable tool for PowerShell users.
Syntax
Get-Help [-Name] <cmdlet_name> [-Category <category_name>] [-ShowWindow <window_type>]
[-Full] [-Error] [-Examples] [-Online] [-PSPath <PSPath>] [-Parameter <parameter_name>]
[-Syntax] [-InputObject <input_object>]
Options/Flags
| Option/Flag | Description | Default Value |
|—|—|—|
| -Name
| Specify the name of the cmdlet or function to get help for. | Required |
| -Category
| Filter the help results by a specific category, such as “Network” or “Security”. | All categories |
| -ShowWindow
| Display the help content in a specific window type: Console
, Message
, Popup
, or None
. | Console
|
| -Full
| Display the full help content, including detailed descriptions, parameters, examples, and related commands. | False
|
| -Error
| Display only the error messages and warnings associated with the command. | False
|
| -Examples
| Display code examples that demonstrate how to use the command. | False
|
| -Online
| Connect to the Microsoft Help service to retrieve the latest help content. | False
|
| -PSPath
| Specify a path to a file or module containing the command to get help for. | N/A |
| -Parameter
| Display help information for a specific parameter of the command. | N/A |
| -Syntax
| Display only the syntax of the command, without full help content. | False
|
| -InputObject
| Use an input object to customize the help content. | N/A |
Examples
Get full help for the “Get-Process” cmdlet:
Get-Help Get-Process -Full
Get help for the “PSPath” parameter of the “Get-Item” cmdlet:
Get-Help Get-Item -Parameter PSPath
Display help content in a popup window:
Get-Help Get-Command -ShowWindow Popup
Connect to Microsoft Help service for up-to-date content:
Get-Help Get-DnsClient -Online
Common Issues
- Command not found: Ensure that the command you are trying to get help for is installed and available in the current PowerShell session.
- Help content not displayed: If the
-ShowWindow
option is set toNone
, the help content will not be displayed. Set it to a valid window type to see the results. - Incorrect syntax: Carefully check the syntax of the
Get-Help
command and make sure you have specified the correct arguments and parameters.
Integration
Get-Help
can be integrated with other PowerShell commands to create powerful scripts. For example:
- Generate a help documentation file:
Get-Help Get-Process -Full | Out-File Help-GetProcess.txt
- Get help for a command from a script:
$script = Get-Content ".\MyScript.ps1"
Get-Help $script
Related Commands
Get-Command
: Get information about commands, functions, scripts, and other PowerShell elements.Help
: Display basic help content for a specified command.About_
: Provides additional information about a specific command.