PowerShell Basic Cmdlets

Cmdlets are the building blocks of PowerShell. Every action in PowerShell — listing files, stopping services, checking processes — is done through a cmdlet. This topic covers the most essential cmdlets that every PowerShell user works with daily.

What Is a Cmdlet?

A cmdlet (pronounced "command-let") is a lightweight, built-in command in PowerShell. Each cmdlet follows a strict naming pattern:

  Verb   -   Noun
  ----       ----
  Get    -   Process      (retrieves running processes)
  Stop   -   Service      (stops a Windows service)
  New    -   Item         (creates a file or folder)
  Remove -   Item         (deletes a file or folder)

The Verb describes the action. The Noun describes what the action applies to. This consistency makes cmdlets easy to guess even before looking them up.

Common Approved Verbs in PowerShell

VerbMeaningExample Cmdlet
GetRetrieve informationGet-Process
SetChange a setting or valueSet-Location
NewCreate something newNew-Item
RemoveDelete somethingRemove-Item
StartStart a process or serviceStart-Service
StopStop a process or serviceStop-Process
WriteSend output to the consoleWrite-Host
CopyDuplicate a file or folderCopy-Item
MoveMove a file or folderMove-Item
TestCheck if something exists or is validTest-Path
InvokeExecute a command or expressionInvoke-Command
SelectChoose specific propertiesSelect-Object
WhereFilter results by conditionWhere-Object
SortSort outputSort-Object
FormatChange how output is displayedFormat-Table

Get-Command – Find Any Cmdlet

Get-Command lists all available cmdlets, functions, and aliases in PowerShell. Use it when unsure what cmdlet to use.


# List all available cmdlets
Get-Command

# Find cmdlets that start with "Get"
Get-Command -Verb Get

# Find cmdlets related to "Service"
Get-Command -Noun Service

# Find cmdlets matching a keyword
Get-Command *process*

Get-Help – Read Documentation

Get-Help displays the documentation for any cmdlet. Think of it as the built-in manual.


# Basic help
Get-Help Get-Process

# Detailed help with parameter descriptions
Get-Help Get-Process -Detailed

# Show usage examples only
Get-Help Get-Process -Examples

# Open help in a separate window
Get-Help Get-Process -ShowWindow

Get-Process – View Running Processes

Get-Process lists all running processes on the computer — similar to Task Manager but in the terminal.


# List all running processes
Get-Process

# Get a specific process by name
Get-Process -Name notepad

# Get the top 5 processes using the most CPU
Get-Process | Sort-Object CPU -Descending | Select-Object -First 5

Sample Output:


Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    540      35    65432      72048      12.50   4512   1 chrome
    320      20    32100      41200       8.30   1024   1 explorer

Get-Service – View Windows Services

Get-Service lists all Windows services and their current status (Running, Stopped, Paused).


# List all services
Get-Service

# Get a specific service by name
Get-Service -Name wuauserv

# List only running services
Get-Service | Where-Object {$_.Status -eq "Running"}

Output:


Status   Name               DisplayName
------   ----               -----------
Running  wuauserv           Windows Update
Stopped  bits               Background Intelligent Transfer Service

Start-Service and Stop-Service


# Start a service (run as Administrator)
Start-Service -Name bits

# Stop a service (run as Administrator)
Stop-Service -Name bits

# Restart a service
Restart-Service -Name bits

Get-ChildItem – List Files and Folders

Get-ChildItem lists the contents of a folder. It works like dir in CMD or ls in Linux. The short alias is ls or dir.


# List files in the current folder
Get-ChildItem

# List files in a specific folder
Get-ChildItem -Path "C:\Windows"

# List only .txt files
Get-ChildItem -Path "C:\Logs" -Filter "*.txt"

# Include subfolders (recursive)
Get-ChildItem -Path "C:\Projects" -Recurse

Set-Location – Change Directory

Set-Location changes the current working directory. The alias is cd.


# Navigate to a folder
Set-Location -Path "C:\Users\Admin\Documents"

# Short form using alias
cd C:\Users\Admin\Documents

# Go up one folder level
cd ..

# Go back to the home directory
cd ~

Write-Host – Display Output

Write-Host prints text directly to the console. It is commonly used in scripts to show messages, status updates, or results.


# Print a simple message
Write-Host "PowerShell is running"

# Print with color
Write-Host "Success!" -ForegroundColor Green
Write-Host "Error occurred!" -ForegroundColor Red
Write-Host "Warning!" -ForegroundColor Yellow

# Print without a new line at the end
Write-Host "Loading" -NoNewline
Write-Host "... Done"

Output:


PowerShell is running
Success!
Error occurred!
Warning!
Loading... Done

Clear-Host – Clear the Console


Clear-Host
# or short alias
cls

Get-Date – Get Current Date and Time


# Get current date and time
Get-Date

# Format the date
Get-Date -Format "dd-MM-yyyy"

# Get just the year
(Get-Date).Year

Output:


Saturday, March 21, 2026 10:30:00 AM
21-03-2026
2026

Measure-Command – Measure Execution Time


# Measure how long a command takes to run
Measure-Command { Get-Process }

Output:


TotalMilliseconds : 145.23

Cmdlet Aliases

PowerShell provides short aliases for common cmdlets so experienced users can type faster.

AliasFull Cmdlet
ls / dirGet-ChildItem
cdSet-Location
pwdGet-Location
clsClear-Host
echoWrite-Output
catGet-Content
cpCopy-Item
mvMove-Item
rm / delRemove-Item
psGet-Process
killStop-Process
?Where-Object
%ForEach-Object

View all aliases in PowerShell:


Get-Alias

Get-Member – Explore Object Properties

Get-Member reveals all the properties and methods of an object returned by a cmdlet. This is one of the most important cmdlets for understanding PowerShell's object-based nature.


# See all properties of Get-Process output
Get-Process | Get-Member

# See all properties of Get-Date output
Get-Date | Get-Member

Partial Output:


TypeName: System.Diagnostics.Process

Name       MemberType     Definition
----       ----------     ----------
CPU        Property       double CPU {get;}
Id         Property       int Id {get;}
Name       Property       string ProcessName {get;set;}

Summary

Cmdlets form the foundation of all PowerShell work. The Verb-Noun naming convention makes them predictable and easy to learn. Get-Command and Get-Help are the two most important cmdlets for discovering and understanding all others. With aliases, experienced users work faster without sacrificing readability.

Leave a Comment