01 / GETTING STARTED · LESSON 02

Find the command you need

Use Get-Command and Get-Help to explore instead of memorising.

9 min · learn at your pace

A name that tells a story

PowerShell commands, called cmdlets, usually follow a Verb-Noun pattern. Get-ChildItem gets the items inside a directory. Get-Date gets the current date. Set-Content writes content to a file.

Use Get-Command to find a command. Wildcards are useful when you know part of a name:

Get-Command -Name '*Content*'

-Name is a parameter. Parameters tell a command which input or option to use. A parameter with no following value is often a switch, such as Get-Help Get-ChildItem -Examples.

Read the help

Get-Help Get-ChildItem
Get-Help Get-ChildItem -Examples

Help explains the syntax, parameter names, and intended behaviour. Some examples describe operating-system features that this browser cannot provide. In this course, each required exercise uses capabilities supported by the lab.

Get-Command returns a command object, not just its name. Later, you will learn to select properties from those objects and connect commands in a pipeline.

Try an example.ps1
Get-Command -Name '*Content*'
YOUR TURN

Put it into practice.

Return the command information object for Get-ChildItem. Use its exact name so your result contains one command.

See an explained solution
One way to solve it.ps1
Get-Command -Name 'Get-ChildItem'

Get-Command reports the command's metadata. The result identifies Get-ChildItem as a cmdlet.