Cmdlets and Commands
Summary: in this tutorial, you will learn understand the verb-noun naming convention, discover commands with get-command, master get-help, and learn parameter usage.
Cmdlets and Commands
PowerShell commands are fundamentally different from traditional shell commands. In traditional shells like CMD or Bash, commands are just strings of text that get parsed and executed. PowerShell does something revolutionary: its commands are called cmdlets (pronounced "command-lets"), and they work with objects, not text.
This tutorial will teach you how PowerShell's command system works, how to discover commands, how to get help, and how to use parameters effectively.
What Are Cmdlets?
A cmdlet is a specialized .NET class that performs a single function. Unlike traditional commands that work by processing text streams, cmdlets work with structured .NET objects. This means when you run a cmdlet, it returns actual objects with properties and methods, not just text output.
Think of it this way: in traditional shells, if you want to get a process and filter by memory usage, you'd have to parse text output with tools like grep and awk. In PowerShell, you work directly with process objects and access their memory properties directly.
# This returns actual Process objects
Get-Process
When you run this command, PowerShell doesn't just print text to the screen. It retrieves actual process objects, and the text you see is just PowerShell's formatted display of those objects.
The Verb-Noun Naming Convention
One of PowerShell's most important design decisions is its consistent naming convention. Every cmdlet follows a strict Verb-Noun pattern. This isn't just a style choice—it's a fundamental part of PowerShell's discoverability.
Why Verb-Noun Matters
In traditional shells, commands have inconsistent names: ls, dir, grep, find, cp, mv, rm. These names are cryptic, short, and hard to remember if you're not already familiar with them. PowerShell takes a different approach: commands should be self-documenting.
Let's look at some examples:
Get-Process # Verb: Get, Noun: Process
Stop-Service # Verb: Stop, Noun: Service
New-Item # Verb: New, Noun: Item
Set-Location # Verb: Set, Noun: Location
Remove-Item # Verb: Remove, Noun: Item
The pattern is immediately clear:
- Get means "retrieve information"
- Set means "change something"
- New means "create something"
- Remove means "delete something"
This consistency means if you know how to get processes with Get-Process, you can probably guess that Get-Service gets services, and Get-EventLog gets event logs. The pattern teaches you the language.
Understanding Verbs
PowerShell defines a standard set of approved verbs. These aren't arbitrary—they're carefully chosen to be intuitive and consistent. Let's understand the most common verb groups:
Data Retrieval Verbs - These get information without changing anything:
Get- The most common verb. Retrieves data. Examples:Get-Process,Get-Content,Get-DateRead- Reads input. Example:Read-Host(asks user for input)Find- Searches for something. Example:Find-ModuleSearch- Like Find, but more extensive. Example:Search-ADAccount
Data Modification Verbs - These change things:
Set- Modifies existing data. Example:Set-Location(change directory),Set-Content(overwrite file)Add- Adds to existing data. Example:Add-Content(append to file)Update- Changes something to a newer version. Example:Update-HelpEdit- Opens something for editing. Example:Edit-File
Creation and Destruction Verbs:
New- Creates something brand new. Example:New-Item,New-VariableRemove- Deletes something. Example:Remove-Item,Remove-VariableClear- Empties content but keeps the container. Example:Clear-Content,Clear-Host
Lifecycle Verbs - Control running operations:
Start- Begin an operation. Example:Start-Process,Start-ServiceStop- End an operation. Example:Stop-Process,Stop-ServiceRestart- Stop and start. Example:Restart-ServiceSuspend- Pause temporarily. Example:Suspend-VMResume- Continue after pause. Example:Resume-VM
Action Verbs - Perform operations:
Invoke- Execute something. Example:Invoke-Command,Invoke-WebRequestTest- Check a condition and return true/false. Example:Test-Path,Test-ConnectionEnable- Turn something on. Example:Enable-PSRemotingDisable- Turn something off. Example:Disable-PSRemoting
Data Transfer Verbs:
Import- Bring data in. Example:Import-Module,Import-CsvExport- Send data out. Example:Export-Csv,Export-ClixmlOut- Send to a specific output. Example:Out-File,Out-GridView,Out-NullConvertTo- Change format for output. Example:ConvertTo-Json,ConvertTo-CsvConvertFrom- Parse input format. Example:ConvertFrom-Json,ConvertFrom-Csv
Let's see these verbs in action. You can discover all approved verbs:
# See all approved verbs
Get-Verb | Sort-Object Verb
# Output shows verbs grouped by category:
# Common, Data, Lifecycle, Diagnostic, etc.
# See verbs in a specific group
Get-Verb -Group Common
Get-Verb -Group Data
Get-Verb -Group Lifecycle
Understanding Nouns
While verbs tell you what action to perform, nouns tell you what you're acting on. Nouns represent the target of the action. Let's look at common noun patterns:
System Resource Nouns:
Process- A running program. Commands:Get-Process,Stop-Process,Start-ProcessService- A background service. Commands:Get-Service,Start-Service,Stop-Service,Restart-ServiceEventLog- System logs. Commands:Get-EventLog,Clear-EventLog
File System Nouns:
Item- A generic file system object (file or folder). Commands:Get-Item,New-Item,Remove-Item,Copy-Item,Move-ItemChildItem- Items inside a directory. Commands:Get-ChildItemContent- The data inside a file. Commands:Get-Content,Set-Content,Add-Content,Clear-ContentLocation- Your current directory. Commands:Get-Location,Set-Location,Push-Location,Pop-Location
Data Structure Nouns:
Variable- A PowerShell variable. Commands:Get-Variable,Set-Variable,New-Variable,Remove-VariableObject- Generic objects. Commands:Select-Object,Where-Object,ForEach-Object,Sort-Object,Group-Object,Measure-Object
Network Nouns:
NetAdapter- Network interface. Commands:Get-NetAdapter,Enable-NetAdapter,Disable-NetAdapterNetIPAddress- IP address config. Commands:Get-NetIPAddress,New-NetIPAddress
Why does this matter? Because once you understand the pattern, you can predict commands. If you want to work with services, you probably want Get-Service, Start-Service, Stop-Service, etc. The naming convention makes PowerShell self-teaching.
Discovering Commands with Get-Command
Now that you understand the naming convention, you need a way to find commands. That's where Get-Command comes in. It's your search engine for PowerShell cmdlets.
The Basics of Get-Command
At its simplest, Get-Command lists all available commands:
# Show all commands (cmdlets, functions, aliases, external programs)
Get-Command
This will show hundreds or even thousands of commands. That's overwhelming, so let's learn to filter.
Searching by Verb
Want to know all the ways you can "get" things? Search by verb:
# Find all commands that "get" something
Get-Command -Verb Get
# This shows:
# Get-Process, Get-Service, Get-Date, Get-Content, Get-ChildItem, etc.
This is incredibly useful when you know what action you want but don't know what you can act on.
# What can I create?
Get-Command -Verb New
# What can I start?
Get-Command -Verb Start
# What can I stop?
Get-Command -Verb Stop
Searching by Noun
Sometimes you know what you want to work with but don't know what actions are available. Search by noun:
# What can I do with processes?
Get-Command -Noun Process
# Output:
# Get-Process, Stop-Process, Start-Process, Wait-Process, Debug-Process
Now you instantly know all process-related commands.
# What can I do with services?
Get-Command -Noun Service
# What can I do with files/items?
Get-Command -Noun Item
# What about child items (directory contents)?
Get-Command -Noun ChildItem
Wildcard Searches
PowerShell supports wildcards (*) for partial matches. This is extremely useful when you're not sure of the exact name:
# Find anything related to "User"
Get-Command *User*
# Output might include:
# Get-LocalUser, New-LocalUser, Remove-LocalUser, etc.
# Find anything with "Service" in the name
Get-Command *Service*
# Find commands that start with "Get-" and end with "Item"
Get-Command Get-*Item*
# Output: Get-Item, Get-ChildItem, Get-ItemProperty, etc.
Searching Across Command Types
PowerShell has different types of commands, and Get-Command can filter by type:
# Find only cmdlets (compiled .NET commands)
Get-Command -CommandType Cmdlet
# How many cmdlets do you have?
Get-Command -CommandType Cmdlet | Measure-Object
# Usually 200-500+ depending on modules loaded
# Find functions (PowerShell-defined commands)
Get-Command -CommandType Function
# Find aliases (shortcuts)
Get-Command -CommandType Alias
# Find external executables
Get-Command notepad
Get-Command git
Get-Command -CommandType Application
Finding Commands from Modules
PowerShell organizes commands into modules. You can see which commands come from a specific module:
# See commands from a specific module
Get-Command -Module Microsoft.PowerShell.Management
# List all modules and their command counts
Get-Module -ListAvailable | Select-Object Name, @{N='Commands';E={(Get-Command -Module $_.Name).Count}}
Pro Tip: When you find a command that looks useful, immediately run Get-Help on it to learn how to use it. The discovery workflow is: Get-Command → Get-Help → Try it.
Mastering Get-Help: Your Built-in Manual
Get-Help is arguably the most important command you'll learn. PowerShell has extensive built-in documentation for every cmdlet. Think of it as having a complete manual built right into the shell.
Why Get-Help Matters
In traditional shells, documentation is often fragmented. You might need to visit websites, read man pages, or search online forums. PowerShell includes comprehensive, consistent documentation for every command.
Updating Help Files
Before using Get-Help effectively, update your help files. PowerShell ships with minimal help to keep the installation small. The full documentation is downloaded on demand:
# Update help files (run this once, or periodically)
Update-Help -Force -ErrorAction SilentlyContinue
# The -ErrorAction SilentlyContinue ignores errors for modules
# that don't have online help
This downloads the latest documentation from Microsoft's servers. You only need to do this once, or occasionally to get updates.
Basic Help Usage
Once help is updated, you can get help for any command:
# Basic help (shows syntax and brief description)
Get-Help Get-Process
This shows a quick overview: what the command does, its syntax (how to use it), and basic parameter information.
Getting Detailed Help
The basic help is just a summary. To see detailed explanations:
# Detailed help (includes parameter descriptions and notes)
Get-Help Get-Process -Detailed
This adds:
- Detailed descriptions of each parameter
- Notes about how the command works
- Related information
Getting Full Help
For complete documentation:
# Full help (everything - very comprehensive)
Get-Help Get-Process -Full
This includes:
- Complete parameter documentation
- Detailed examples
- Input/output type information
- Technical notes
Learning by Examples
Often the best way to learn a command is to see examples:
# Show only the examples
Get-Help Get-Process -Examples
This shows real-world usage examples. Microsoft's help authors include excellent examples that demonstrate common scenarios.
Opening Online Documentation
PowerShell help is also available on Microsoft's website with better formatting and hyperlinks:
# Open the online help in your browser
Get-Help Get-Process -Online
This opens the official Microsoft documentation page for the cmdlet. Online docs are often more readable and include community comments.
Understanding Help Output Structure
When you run Get-Help Get-Process -Full, the output is organized into sections. Let's understand each section:
1. NAME - The command name. Simple.
2. SYNOPSIS - A one-sentence description of what the command does.
3. SYNTAX - This is where it gets interesting. The syntax section shows you how to call the command with different parameter combinations. Let's break down what you're seeing:
Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [<CommonParameters>]
Get-Process -Id <Int32[]> [-ComputerName <String[]>] [<CommonParameters>]
These are called parameter sets. They represent different ways to use the same command. Let's decode the notation:
[[-Name] <String[]>]- Brackets mean optional. Double brackets around-Namemean it's positional (you can omit the parameter name).<String[]>means it accepts one or more strings.-Id <Int32[]>- No outer brackets, soInt32[]is required when using this parameter set. Accepts one or more integers.[<CommonParameters>]- All cmdlets support common parameters like-Verbose,-ErrorAction, etc.
4. DESCRIPTION - A detailed explanation of what the command does and when to use it.
5. PARAMETERS - Each parameter is documented:
- What it does
- What type of value it accepts
- Whether it's required or optional
- Whether it accepts pipeline input
- Default values
6. EXAMPLES - Real usage scenarios with explanations.
7. RELATED LINKS - Other commands you might want to explore.
Searching Help with Wildcards
You can use wildcards to search for help topics:
# Find all help topics about wildcards
Get-Help *wildcard*
# Find all help about regular expressions
Get-Help *regex*
# Find all help about operators
Get-Help *operator*
About Topics: Conceptual Help
PowerShell includes conceptual help articles that explain concepts rather than specific commands:
# List all about topics
Get-Help about_*
These are gold mines of information. Some essential ones:
# Learn about comparison operators
Get-Help about_Comparison_Operators
# Learn about regular expressions
Get-Help about_Regular_Expressions
# Understand the pipeline
Get-Help about_Pipelines
# Master hash tables
Get-Help about_Hash_Tables
# Learn about arrays
Get-Help about_Arrays
# Understand operators
Get-Help about_Operators
# Learn about automatic variables
Get-Help about_Automatic_Variables
# Understand script blocks
Get-Help about_Script_Blocks
Reading through the about_* topics is one of the best ways to deeply understand PowerShell.
Study Tip: Pick one about_* topic per day and read it thoroughly. In a month, you'll have a comprehensive understanding of PowerShell fundamentals.
Understanding Parameters
Parameters are how you control what a cmdlet does. They're like knobs and switches on a machine—they change the behavior of the command. PowerShell has several types of parameters, and understanding them is crucial.
Named Parameters
The most common way to use parameters is by name. You specify the parameter name, followed by its value:
# Using named parameters
Get-Process -Name "explorer"
# Multiple parameters
Get-Process -Name "explorer" -ComputerName "localhost"
The parameter name always starts with a hyphen (-). The value comes after.
Parameter Abbreviation
PowerShell allows you to abbreviate parameter names, as long as the abbreviation is unambiguous:
# These are all equivalent:
Get-Process -Name "explorer"
Get-Process -Na "explorer" # Abbreviated to -Na
Get-Process -N "explorer" # Abbreviated to -N
However, don't use abbreviations in scripts. They make code harder to read. Abbreviations are only for interactive use.
Positional Parameters
Some parameters are positional, meaning you can provide their values without specifying the parameter name. PowerShell knows which parameter you mean based on the position:
# These are equivalent:
Get-Process -Name "explorer"
Get-Process "explorer" # -Name is positional (position 0)
# These are equivalent:
Get-ChildItem -Path "C:\" -Filter "*.txt"
Get-ChildItem "C:\" "*.txt" # Both are positional
How do you know if a parameter is positional? Check the help:
Get-Help Get-Process -Parameter Name
# The output shows:
# -Name <String[]>
# Position: 0 ← This tells you it's positional
Position 0 means it's the first parameter. If you provide a value without a parameter name, PowerShell assumes it's for position 0.
Switch Parameters
Some parameters are switches—they don't take a value. They're either on or off:
# -Recurse is a switch parameter
Get-ChildItem -Recurse # Recurse is ON
# Without the switch, it's off
Get-ChildItem # Recurse is OFF
You can explicitly set switch parameters to true or false:
# Explicitly set to true
Get-ChildItem -Recurse:$true
# Explicitly set to false (same as omitting it)
Get-ChildItem -Recurse:$false
The explicit syntax is useful when you're building dynamic commands and need to conditionally include a switch.
Mandatory vs. Optional Parameters
Some parameters are required, others are optional:
# Get-Content requires a -Path parameter
Get-Content -Path "file.txt" # Works
Get-Content # Error: Missing required parameter -Path
Optional parameters have defaults or aren't needed:
# Get-Process doesn't require any parameters
Get-Process # Works - shows all processes
Array Parameters
Many parameters accept arrays (multiple values):
# Get multiple processes by name
Get-Process -Name "explorer", "chrome", "firefox"
# Equivalent using an array variable
$processNames = "explorer", "chrome", "firefox"
Get-Process -Name $processNames
# Get multiple files
Get-ChildItem -Path "C:\", "D:\"
Common Parameters
Every cmdlet automatically supports a set of common parameters. These aren't defined by the cmdlet author—they're built into PowerShell. The most important ones:
Error Control Parameters:
# Stop execution if an error occurs
Get-Content "nonexistent.txt" -ErrorAction Stop
# Silently ignore errors
Get-Content "nonexistent.txt" -ErrorAction SilentlyContinue
# Show error but continue (default)
Get-Content "nonexistent.txt" -ErrorAction Continue
# Store errors in a variable
Get-Content "nonexistent.txt" -ErrorVariable myErrors
$myErrors # Check what errors occurred
Output Control:
# Store output in a variable (in addition to sending down the pipeline)
Get-Process -OutVariable results
$results # Contains the same process objects
# Control output buffering
Get-Process -OutBuffer 100
Diagnostic Parameters:
# Show detailed information about what the cmdlet is doing
Get-Process -Verbose
# Show debugging information
Get-Process -Debug
# Show what WOULD happen without actually doing it
Remove-Item *.txt -WhatIf # Safe - just shows what would be deleted
# Ask for confirmation before each action
Remove-Item *.txt -Confirm # Prompts for each file
Safety First: Always use -WhatIf before running commands that modify or delete things. It's your safety net. Once you see what would happen, remove -WhatIf to actually execute.
Parameter Splatting
When you have many parameters, your command line can become very long and hard to read:
# This is hard to read
Send-MailMessage -To "user@example.com" -From "admin@example.com" -Subject "Monthly Report" -Body "Please see the attached report." -SmtpServer "mail.example.com" -Port 587 -UseSsl -Credential $cred -Attachments "report.csv"
PowerShell offers splatting to make this cleaner. You put all parameters in a hashtable, then "splat" them onto the command:
# Using splatting - much cleaner
$mailParams = @{
To = "user@example.com"
From = "admin@example.com"
Subject = "Monthly Report"
Body = "Please see the attached report."
SmtpServer = "mail.example.com"
Port = 587
UseSsl = $true
Credential = $cred
Attachments = "report.csv"
}
Send-MailMessage @mailParams
Notice we use @mailParams (not $mailParams) when splatting. The @ tells PowerShell to expand the hashtable as parameters.
Benefits of splatting:
- Easier to read
- Easier to comment individual parameters
- Easier to conditionally include parameters
- Reusable parameter sets
Here's how you conditionally include parameters:
$params = @{
Path = "C:\Logs"
Filter = "*.log"
}
# Conditionally add -Recurse
if ($searchSubfolders) {
$params.Recurse = $true
}
Get-ChildItem @params
Splatting is especially useful in functions and scripts where you're building commands dynamically.
Written by the ShellRAG Team
The ShellRAG editorial team writes practical, beginner-friendly PowerShell tutorials with tested code examples and real-world use cases. Every article is technically reviewed for accuracy and updated regularly.
Learn more about us →