ScriptRunner Blog
Mastering PowerShell with Get-Help
Table of contents
Learn how the PowerShell cmdlet Get-Help improves your understanding of this great IT automation technology .
PowerShell, Microsoft's task automation and configuration management framework, offers a powerful command-line shell and scripting language for every system administrator and IT professional. One of the most fundamental and useful cmdlets in PowerShell is Get-Help. This cmdlet is your gateway to understanding and utilizing the vast array of commands available in PowerShell. Whether you're a beginner or an experienced professional, Get-Help is indispensable for navigating and mastering PowerShell commands.
Understanding Get-Help
Get-Help is a cmdlet that retrieves detailed information about PowerShell cmdlets, functions, scripts, and concepts. It is designed to help users learn about the commands, their syntax, examples of usage, parameters, and much more. Essentially, it acts as a built-in manual, providing the necessary guidance to effectively use PowerShell.
Syntax and usage
The basic syntax of Get-Help is straightforward:
Get-Help <Name> [-Full] [-Examples] [-Parameter <Name>] [-Online]
- <Name>: The name of the cmdlet, function, script, or concept you want help with.
- -Full: Displays complete help information, including descriptions, parameters, examples, and additional notes.
- -Examples: Shows examples of how to use the cmdlet.
- -Parameter: Provides detailed information about a specific parameter of the cmdlet.
- -Online: Opens the online version of the help document in your default web browser, providing the most up-to-date information.
How to start using Get-Help
Display help information about the PowerShell help system:
Get-Help
To understand how a particular cmdlet works, simply use Get-Help followed by the cmdlet's name. For instance, to learn about Get-Process, you would enter:
Get-Help Get-Process
In case you don't know the exact name of a cmdlet, you can work with wildcards:
Get-Help Get-Pr*
Another way of asking for help:
Get-Process -?
You want to learn about conceptual PowerShell topics? Use about_ to specify what you are looking for. To retrieve information about how ForEach loops work:
Get-Help about_ForEach
More helpful options
For those seeking comprehensive details, the -Full parameter is invaluable. It gives you everything you need to know about a cmdlet, including detailed parameter descriptions and inputs/outputs.
Get-Help Get-Process -Full
If you're looking for practical usage examples, the -Examples parameter will be particularly useful. It shows various ways to use the cmdlet in real-world scenarios, helping you understand the cmdlet's versatility.
Get-Help Get-Process -Examples
The -Online parameter lets you access the most current help documentation available on the internet. It will open a browser windows and display the Microsoft online article.
Get-Help Get-Process -Online
With -ShowWindow you can open the PowerShell help system in a separate Window.
Note: This parameter only works on a Windows machine.
Get-Help Get-Process -ShowWindow
Keep your PowerShell help up-to-date
As PowerShell evolves, so does its documentation. New cmdlets are introduced, and existing ones are updated with new features and parameters. To ensure that the help content on your system is current, PowerShell provides the Update-Help cmdlet. This cmdlet downloads and installs the latest help files for PowerShell modules, ensuring that when you use Get-Help, you're getting the most recent information available.
Update-Help downloads the latest help files from the internet and updates the help content on your system for installed modules. It's a simple yet powerful way to keep your help documentation in sync with the latest PowerShell versions and capabilities.
The basic syntax of Update-Help is as follows:
Update-Help [-Module <String[]>] [-Force] [-UICulture <CultureInfo[]>] [-Credential <PSCredential>]
- -Module <String[]>: Specifies the modules to update help for. If not specified, Update-Help updates all modules that support updatable help and are installed on your computer.
- -Force: Forces an update of help files, even if they have been updated within the last 24 hours.
- -UICulture <CultureInfo[]>: Specifies the UI culture (language) for the updated help files. This is useful if you prefer help content in a specific language.
- -Credential <PSCredential>: Provides credentials that have permission to access the internet if your environment requires authentication.
To update help content for all modules that support updatable help, simply run:
Update-Help
You want to update help files for a specific module? No problem. Here's an example that updates only help for the Applocker module:
Update-Help -Module Applocker
Conclusion
The Get-Help and Update-Help cmdlets are more than just features; they are foundational tools that enable users to harness the full power of PowerShell. By making these cmdlets a part of your daily workflow, you ensure that you're always equipped with the latest knowledge and best practices to tackle any task in PowerShell efficiently and effectively.
Your ultimate PowerShell cheat sheet
Unleash the full potential of PowerShell with our handy poster. Whether you're a beginner or a seasoned pro, this cheat sheet is designed to be your go-to resource for the most important and commonly used cmdlets.
The poster is available for download and in paper form.
Related links
About the author:
Heiko Brenn is Product Marketing Manager and responsible for the ScriptRunner marketing team. He has been working in the IT industry for more than 25 years and has extensive expertise in email management, security, collaboration, administration, cloud and automation. He has been working with PowerShell since 2010.