Lesson 3 of 5  ·  Beginner

Cmdlets & the Help System

⏱ ~15 minutes Beginner

What is a Cmdlet?

A cmdlet (pronounced "command-let") is a built-in PowerShell command. They are the core building blocks of everything you do in PowerShell.

Cmdlets follow a consistent Verb-Noun naming pattern:

The VERB says what you do
Get- Set- New- Remove- Start- Stop- Import- / Export- Convert- / Format-
The NOUN says what you act on
Process Service Item / ChildItem Content Object Variable Module Command

So Get-Process = get information about processes. Stop-Service = stop a service. Remove-Item = delete a file. The pattern is consistent throughout all of PowerShell!

Discovering Commands with Get-Command

Get-Command is your tool for finding available commands. Use wildcards (*) to search:

Get-Command — Discovering Commands
# Find all commands with "service" in the name
PS C:\> Get-Command *service*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet New-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet Remove-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet Restart-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet Set-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet Start-Service 7.0.0.0 Microsoft.PowerShell.Management
Cmdlet Stop-Service 7.0.0.0 Microsoft.PowerShell.Management

# Find all cmdlets with verb "Get"
PS C:\> Get-Command -Verb Get | Select-Object -First 10

# Find all cmdlets with noun "Item"
PS C:\> Get-Command -Noun Item

The Help System — Get-Help

Get-Help is your best friend. Whenever you encounter an unfamiliar cmdlet, use Get-Help to learn everything about it.

First time? Run Update-Help once (as Administrator) to download the latest help files. Without this, help content may be missing or incomplete.
Get-Help in Action
# Basic help — synopsis and syntax
Get-Help Get-ChildItem

# Just show examples (most useful!)
Get-Help Get-ChildItem -Examples

# Full documentation — all parameters explained
Get-Help Get-ChildItem -Full

# Open the online documentation in browser
Get-Help Get-ChildItem -Online

# Help about a specific parameter
Get-Help Get-ChildItem -Parameter Recurse

# Conceptual help topics (no cmdlet, just concepts)
Get-Help about_Variables
Get-Help about_Pipelines

Discovering Object Members with Get-Member

Since everything in PowerShell is an object, you can pipe any output to Get-Member to see what properties and methods it has:

Get-Member — Exploring Objects
# What properties/methods does a Process object have?
Get-Process | Get-Member
TypeName: System.Diagnostics.Process
Name MemberType Definition
---- ---------- ----------
Kill Method void Kill()
... ... ...
CPU Property double CPU
Id Property int Id
Name Property string Name
WorkingSet Property long WorkingSet

# What can you do with a string?
"hello" | Get-Member

# Only show Properties
Get-ChildItem | Get-Member -MemberType Property
💡
The Discovery Trinity: Use these three commands together to explore anything in PowerShell:
Get-Command → find commands | Get-Help → understand a command | Get-Member → explore what an object can do

Parameters

Parameters customize how a cmdlet behaves. They start with a dash (-):

Using Parameters
# Without parameters
Get-ChildItem

# With parameters — explicit
Get-ChildItem -Path C:\Windows -Recurse -Filter *.exe

# Switch parameters (no value needed — like a toggle)
Get-ChildItem -Recurse # -Recurse is $true when present

# Positional parameters (some don't need the name)
Get-ChildItem C:\Windows # -Path is positional

# Common parameters (work on ALL cmdlets)
Get-ChildItem -Verbose # Detailed progress info
Remove-Item *.tmp -WhatIf # Preview without doing
Remove-Item *.tmp -Confirm # Ask before each delete

Aliases — Shortcuts for Cmdlets

PowerShell includes short aliases for common cmdlets. They're great in the console, but in scripts it's better to use full names for clarity:

Common Aliases
# File system aliases
ls = Get-ChildItem
cd = Set-Location
pwd = Get-Location
cat = Get-Content
cp = Copy-Item
mv = Move-Item
rm = Remove-Item
mkdir= New-Item -ItemType Directory

# Pipeline aliases
? = Where-Object
% = ForEach-Object
sort = Sort-Object
select = Select-Object

# Find what an alias points to
Get-Alias ls
CommandType Name Version Definition
----------- ---- ------- ----------
Alias ls          Get-ChildItem

-WhatIf: Preview Before You Act

Many cmdlets support -WhatIf. This shows you what would happen without actually doing it — perfect for testing dangerous operations before committing:

-WhatIf Safety Preview
# Safely preview what files would be deleted
Remove-Item C:\Temp\* -Recurse -WhatIf
What if: Performing the operation "Remove File" on target "C:\Temp\old.log".
What if: Performing the operation "Remove File" on target "C:\Temp\debug.txt".

# Nothing was actually deleted! Use without -WhatIf when ready.
⚠️
Good habit: Before running any Remove-Item, Move-Item, or other destructive command in a script, test it with -WhatIf first. This can save you from accidentally deleting the wrong files.

🧪 Try It Yourself

  1. Run Get-Command -Verb Get and count how many cmdlets start with Get
  2. Run Get-Help Write-Host -Examples and try one of the examples
  3. Run Get-Date | Get-Member — explore the DateTime object's properties
  4. Run Get-Alias to see all aliases, or Get-Alias cd to check what cd does
  5. Try Remove-Item *.xyz -WhatIf (won't delete anything — it's a preview)

Key Takeaways

  • Cmdlets follow the Verb-Noun pattern (Get-Process, Stop-Service, New-Item)
  • Use Get-Command *keyword* to discover commands
  • Use Get-Help cmdlet -Examples to learn how to use any command
  • Use Get-Member to explore what properties and methods an object has
  • Parameters start with - (e.g., -Recurse, -Filter)
  • -WhatIf previews destructive operations safely