Wednesday, May 8, 2019

Getting help

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
The output is illustrated in the following image:
Getting help
The sections in the image are explained as follows:
  • 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:
Getting help
If we press Enter, we can view one line after another, whereas pressing the space key will give a page view.

Note

Keep your files updated using the Update-Help cmdlet as shown in the following command. Ensure that your machine has internet connectivity and execute the following command:
Update-Help –Verbose
This cmdlet is designed to download and install help files on our computer.
The output is illustrated in the following image:
Getting help
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 for Get-Help (Aliases will be covered in the next section).
  • The Get-Help cmdlet allows us to view the online help using the Online 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
    
    The output of the preceding code is illustrated in the following image:
    Getting help
  • To view only syntax, we can execute the following code:
    (Get-Help Get-Service).Syntax

No comments:

Post a Comment

Remote Hybrid and Office work