PowerShell Syntax and Cmdlets
Every built-in PowerShell command, called a cmdlet, follows a strict Verb-Noun naming pattern, such as Get-Process, Stop-Service, or New-Item. The verb always comes from an approved list you can view with Get-Verb (Get, Set, New, Remove, Start, Stop, and dozens more), which keeps cmdlet names predictable: once you know the pattern, you can often guess a cmdlet's name correctly without ever opening documentation.
Cricket analogy: PowerShell's Verb-Noun naming, like Get-Process or Stop-Service, is as predictable as cricket's over-by-over scorecard notation - once you know the approved verb list (Get-Verb) the way you know 'run out' or 'caught behind' means, any new cmdlet name is instantly readable.
Parameters and Aliases
Cmdlets accept named parameters (Get-ChildItem -Path C:\Temp) and, for the most common ones, positional parameters where the name can be omitted. Common cmdlets also have short aliases baked in for interactive speed - gci, dir, and ls all resolve to Get-ChildItem - and PSReadLine's tab completion works on cmdlet names, parameter names, and even file paths, cycling through matches as you press Tab repeatedly.
Cricket analogy: Aliases like gci for Get-ChildItem are like a commentator's shorthand 'six over cover' instead of the full technical description - fast in a live broadcast, but a written match report (a script) spells it out fully for clarity.
Getting Help
Get-Help <cmdlet> -Full shows a cmdlet's complete documentation including every parameter, while -Examples strips it down to just runnable sample usages, ideal for a quick reminder. Get-Command lists every cmdlet, function, and alias currently available in the session, and can be filtered by verb or noun (Get-Command -Verb Get -Noun *Item*). The first time you use Get-Help on a fresh install, PowerShell will prompt you to run Update-Help to download the actual help content.
Cricket analogy: Get-Help with -Examples is like flipping straight to a coaching manual's worked-example net session instead of reading the full theory chapter, while Get-Command is like the team's full squad list you can browse before deciding who to call up.
Get-Command -Verb Get -Noun *Item* is a fast way to discover related cmdlets by pattern before you even know the exact name you need - e.g. it surfaces Get-Item, Get-ChildItem, and Get-ItemProperty in one query.
Combining Cmdlets in the Pipeline
Cmdlets are combined with the pipe operator (|), and inside a script block passed to filtering cmdlets like Where-Object or ForEach-Object, the automatic variable $_ (or its alias $PSItem) refers to the current object being processed. So Get-Process | Where-Object { $_.CPU -gt 50 } | ForEach-Object { $_.Name } filters processes by CPU usage and then extracts just the Name property from each surviving object, one at a time.
Cricket analogy: The $_ variable inside ForEach-Object | Where-Object is like a fielding coach referring to 'this ball' while reviewing footage - each iteration through the pipeline, $_ points to whichever delivery (object) is currently under review before moving to the next.
Aliases like gci, ls, and % (for ForEach-Object) are convenient interactively but should generally be avoided in saved scripts. Full cmdlet names like Get-ChildItem and ForEach-Object are self-documenting and far more readable to a teammate - or to you six months later - than terse aliases.
# Full cmdlet names combined with the pipeline and $_ automatic variable
Get-Process |
Where-Object { $_.CPU -gt 50 } |
ForEach-Object { "$($_.Name) is using $($_.CPU) seconds of CPU" }
# Discover related cmdlets by verb and noun pattern
Get-Command -Verb Get -Noun *Item*
# Read a specific example from help
Get-Help Get-ChildItem -Examples- Cmdlets follow a strict Verb-Noun naming pattern; Get-Verb lists all approved verbs.
- Parameters can be named (-Path) or, for common ones, positional.
- Built-in aliases like gci, dir, and ls all resolve to Get-ChildItem.
- Get-Help -Examples and -Full, plus Get-Command, are the core discovery tools.
- $_ (or $PSItem) refers to the current object inside a Where-Object or ForEach-Object script block.
- The pipe operator (|) chains cmdlets so each one's object output feeds the next.
- Avoid aliases in saved scripts; use full cmdlet names for readability.
Practice what you learned
1. Which cmdlet lists every approved verb PowerShell cmdlets are allowed to use?
2. Which of the following are all valid aliases for Get-ChildItem?
3. Inside `Where-Object { $_.CPU -gt 50 }`, what does $_ refer to?
4. What is the difference between Get-Help -Examples and Get-Help -Full for a cmdlet?
Was this page helpful?
You May Also Like
What Is PowerShell?
An introduction to PowerShell as Microsoft's object-oriented shell and scripting language, covering what sets it apart from traditional command-line tools.
Variables and Data Types
How PowerShell stores data in loosely-typed variables, the common .NET types you'll use daily, and how to cast and inspect types explicitly.
Your First PowerShell Script
Write, save, and run a real .ps1 script with parameters, control flow, and functions, and understand execution policy before you run it.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics