Discover commands in Powershell

Powershell has a built in help system. Userhelp to read mroe about a command, what the command does, and how to call it.
By inspecting what the command returns you can customize the output. This will help determine what commands are logically grouped and how to use the commands together.

Help system

By using the built in help system you can find out more about a specific command. Use the Get-Command cmdlet to locate a command that you need. After you have found it, you might want to know more about what the command does and various ways to call it.

Invoke the Get-Help command to learn more about a command. Typically you invoke Get-Help by specifying it by name and adding the -Name flag that contains the name of the cmdlet you want to learn about.

Get-Help -Name Get-Help

Update Help

New versions don’t have the Get-Help cmdlet by default. The first time you run Get-Help you’re asked to install the help files. You can also run the Update-Help cmdlet to install the help files. Because a call to UPdate-Help downloads many help files, the command can fetch only once per day by default. You can override this fetching behavior by using the -Force flag

Explore help sections

When you invoke Get-Help on a cmdlet, a help page is returned. The page includes many sections. You’ll likely see these common sections

  • NAME
  • SYNTAX
  • ALIASES
  • REMARKS
  • PARAMETERS

Filter the help response

If you don’t want the full display, narrow the response by adding flags to your Get-Help command. Here are some flags you can use:

  • Full
  • Detailed
  • Examples
  • Online
  • Parameter

For example you can use the following command to return only the example section of the help page

Get-Help Get-Filehash -Examples

Improve reading experience with help alias

Running Get-Help returns the entire help page. The page might not provide the best reading experience. You might want to use the help alias. The help alias pipes Get-Help into a function that ensures your output is readable line by line. It also makes the response readable page by page, by paginating the output.

help Get-Filehash

NAME
Get-FileHash

SYNTAX
Get-FileHash [-Path] [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160}] []

Get-FileHash -LiteralPath <string[]> [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160}]  [<CommonParameters>]

Get-FileHash -InputStream <Stream> [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160}]  [<CommonParameters>]

ALIASES
None

REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
— To download and install Help files for the module that includes this cmdlet, use Update-Help.
— To view the Help topic for this cmdlet online, type: “Get-Help Get-FileHash -Online” or
go to https://go.microsoft.com/fwlink/?LinkId=517145.

help Get-Filehash -Examples
Leave a Reply 0

Your email address will not be published. Required fields are marked *