Getting help
This is the most important and interesting topic. No matter what technology we consume, all we need to know is the way to get help for it. Most IT professionals and developers say that they use Google to find this.
For PowerShell, help is much more focused. It's very difficult to remember all the commands. So, we can search for a command and find help for the same. Let's take a look at how to seek help for Windows PowerShell cmdlets.
Get-Help Get-Service
- NAME: This is the name of the command (
Get-Service
) - SYNOPSIS: This is the abstract of the command
- SYNTAX: This gives us the syntax of the commands, which includes all its parameters and its type
- DESCRIPTION: This is the description of the command whose help we are looking for
- RELATED LINKS: This contains the URL of online versions of the command, and other commands related to the one we are looking for help regarding
- REMARKS: This will guide us to explore examples, detailed information, full help, and online help
If more information than that fitting the page view is to be displayed, the console is paginated. For example, if we execute the
Get-Help Get-Service -Detailed | more
command, the details will output as shown in the following image:
If we press Enter, we can view one line after another, whereas pressing the space key will give a page view.
Ensure that you have an Internet connection while updating your help. The reason for updating help is to keep the help document up-to-date. Let us learn more about the
Get-Help
cmdlet:- The
Help
cmdlet is an alias forGet-Help
(Aliases will be covered in the next section). - The
Get-Help
cmdlet allows us to view the online help using theOnline
parameter. The following command will open the online URL in the default web browser:Get-Help Get-Service –Online
- The
Get-Help
cmdlet allows us to view the help content in a separate user interface. The following is the command that needs to be executed:Get-Help Get-Service –ShowWindow
- To view only syntax, we can execute the following code:
(Get-Help Get-Service).Syntax
No comments:
Post a Comment