Cmdlets

By the end of this lesson you'll read any cmdlet's name and know what it does, discover new ones without Googling, and drive them precisely with parameters and aliases — the skill that unlocks the entire 1,400+ cmdlet PowerShell toolbox.

Learn Python, JavaScript, Java and more with free interactive lessons, real projects and AI-powered help. Beginner-friendly.

Part of the free Powershell course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.

Think of cmdlets as a well-organised toolbox where every tool is labelled action + object : "tighten-bolt", "loosen-bolt", "cut-pipe". You'd never need an index — reading the label tells you exactly what each tool does, and if you want to loosen something you already know the label starts with "loosen". PowerShell is built this way on purpose: Get-Service , Stop-Service , Restart-Service . Learn the handful of verbs and you can predict command names instead of memorising 1,400 of them.

1. The Verb-Noun Structure

Every cmdlet (PowerShell's word for a built-in command) is named Verb-Noun . The verb is the action; the noun is what it acts on, and the noun is always singular. Microsoft publishes a list of approved verbs so the vocabulary stays consistent: Get- retrieves, Set- changes, New- creates, Remove- deletes. Once that clicks, a name like Get-Service needs no explanation. Read this worked example, then run it.

Run Get-Verb any time to see the full approved list. Sticking to these verbs is not just style — PowerShell prints a warning when a module uses an unapproved verb, because non-standard names are exactly what break the "guessable" promise.

2. Discovering Cmdlets (don't guess — find)

You are not expected to know every cmdlet. Three discovery tools cover almost everything. Get-Command finds cmdlets — filter by -Verb or -Noun to zero in. Get-Help <name> -Examples shows copy-paste usage for one cmdlet. Get-Member pipes an object in and lists the properties and methods it actually has, so you know what you can sort or filter on. This trio is the most important habit in the whole language.

Now you try. The program below is almost complete — fill in the two blanks marked ___ using the hints in the comments, then run it.

3. Parameters & Parameter Sets

A parameter customises what a cmdlet does. It starts with a dash. There are three flavours you'll meet constantly: a named parameter is spelled out ( -Path C:\Temp ) and order doesn't matter; a positional parameter can drop its name because PowerShell knows it by position ( -Path is position 0 for Get-ChildItem ); and a switch is an on/off flag with no value ( -Recurse ). Many cmdlets also define parameter sets — groups of parameters that can't be mixed (e.g. ask for a service by -Name or by -DisplayName , not both). Run Get-Command <name> -Syntax to see them; positional parameters show as [[-Name] <type>] .

PowerShell supports parameter abbreviation : type only enough letters to be unambiguous. -Re works for -Recurse and -Pa for -Path — but spell them out in saved scripts so a future reader (or a new parameter that makes -Re ambiguous) never trips you up.

4. Aliases

An alias is a short nickname for a full cmdlet name. PowerShell ships with familiar ones so people coming from other shells feel at home: ls and dir both run Get-ChildItem , cd runs Set-Location , cat runs Get-Content . They're great for fast typing at the prompt. Use Get-Alias to see what any alias really points to.

Your turn again — two blanks. Prove to yourself that an alias and its cmdlet are the same thing.

Here's a small but real script that uses the three Get- cmdlets you'll reach for most — Get-Process , Get-Service , and Get-ChildItem — with the discovery and parameter skills from this lesson. You understand every line now.

Each cmdlet emits objects , not text — which is why you can Sort-Object WS and Select-Object Name . 1MB is a built-in PowerShell unit (1,048,576), so dividing bytes by it gives megabytes.

No blanks this time — just a brief and an outline to keep you on track. Build it, run it, and check your output against the example in the comments. Discovering "what cmdlets exist for X" is something you'll do constantly in real work.

Practice quiz

In the cmdlet name Get-Service, which part is the verb?

  • Get
  • Service
  • The dash
  • Neither

Answer: Get. The verb is the action (Get); the noun is the thing acted on (Service).

Which cmdlet lists all the approved PowerShell verbs?

  • Get-Noun
  • List-Verbs
  • Get-Verb
  • Show-Verb

Answer: Get-Verb. Get-Verb prints the approved verbs like Get, Set, New, and Remove.

How would you find every cmdlet whose noun is Service?

  • Get-Command -Noun Service
  • Find-Service -All
  • Get-Service -List
  • Search-Noun Service

Answer: Get-Command -Noun Service. Get-Command -Noun Service finds all cmdlets that act on services.

What is a switch parameter like -Recurse?

  • A parameter needing a number
  • An on/off flag with no value
  • An alias
  • A positional value

Answer: An on/off flag with no value. A switch is a true/false flag; its presence alone turns the feature on.

Which command shows whether a parameter is positional?

  • Get-Member
  • Get-Help -Full
  • Get-Command <name> -Syntax
  • Get-Alias

Answer: Get-Command <name> -Syntax. Get-Command <name> -Syntax shows positional parameters as [[-Name] <type>].

What does the alias ls run?

  • Set-Location
  • Get-Content
  • Remove-Item
  • Get-ChildItem

Answer: Get-ChildItem. ls is an alias for Get-ChildItem, which lists items in a location.

Which cmdlet does the alias cd map to?

  • Set-Location
  • Get-Location
  • Move-Item
  • Push-Location

Answer: Set-Location. cd is an alias for Set-Location, which changes the current directory.

For Get-ChildItem, -Path is position 0. What does that allow?

  • Skipping the value
  • Dropping the -Path name and passing the value directly
  • Recursing automatically
  • Sorting output

Answer: Dropping the -Path name and passing the value directly. A positional parameter lets you omit its name: Get-ChildItem C:\Temp equals Get-ChildItem -Path C:\Temp.

Why should saved scripts spell out full cmdlet names instead of aliases?

  • Aliases run slower
  • Aliases are not always portable or guaranteed
  • Aliases cause syntax errors
  • Aliases are deprecated

Answer: Aliases are not always portable or guaranteed. Aliases can be reassigned or differ between systems, so full names are safer in scripts.

Which cmdlet shows what an object's properties and methods are?

  • Get-Command
  • Get-Help
  • Get-Property
  • Get-Member

Answer: Get-Member. Get-Member inspects an object and lists its properties and methods.