PowerShell Cheatsheet - PowerShell Command Reference

Essential PowerShell commands for Windows system administration and automation, organized by scenario from file operations to remote management. Copy directly.

SysOps·58 commands·Last updated 2026-07-21
Back to SysOps

Basic Commands 5

Get-Command
List all available PowerShell commands (cmdlets, functions, aliases)
Get-Help Get-Process
View command help, add -Detailed for more info
Get-Member
View properties and methods of pipeline objects
Get-Verb
List all PowerShell-approved verbs
Get-Alias
List all command aliases

File & Directory 8

Get-ChildItem
List directory contents, similar to ls/dir
Set-Location ..
Change directory, similar to cd
New-Item -ItemType Directory -Path C:\NewDir
Create new directory or file
Copy-Item src.txt dst.txt
Copy file or directory, similar to cp
Move-Item src.txt dst.txt
Move or rename file, similar to mv
Remove-Item file.txt
Delete file or directory, similar to rm
Rename-Item old.txt new.txt
Rename file or directory
Test-Path C:\path
Check if path exists, returns True/False

Content Operations 8

Get-Content file.txt
Read file content, similar to cat
Set-Content file.txt "text"
Write content to file (overwrite)
Add-Content file.txt "text"
Append content to file
Out-File output.txt
Write output to file
Export-Csv data.csv -NoTypeInformation
Export objects to CSV file
Import-Csv data.csv
Import objects from CSV file
ConvertTo-Json
Convert object to JSON format
ConvertFrom-Json
Create object from JSON string

Pipeline & Filtering 6

Where-Object { $_.Name -eq "svchost" }
Filter objects, similar to grep, can use where alias
Select-Object -First 10 Name,Id
Select object properties or first N items
Sort-Object Name -Descending
Sort objects by property
Group-Object Status
Group objects by property
Measure-Object -Sum -Average
Calculate numeric statistics (sum, average, etc.)
ForEach-Object { $_ * 2 }
Perform operation on each pipeline object

Process & Service 9

Get-Process
List all running processes, similar to ps
Get-Process -Name "chrome"
Find process by name
Stop-Process -Name "notepad"
Stop a process, similar to kill
Start-Process notepad.exe
Start a new process
Get-Service
List all Windows services
Start-Service Spooler
Start a service
Stop-Service Spooler
Stop a service
Restart-Service Spooler
Restart a service
Set-Service Spooler -StartupType Automatic
Set service startup type (Automatic/Manual/Disabled)

Network & Remote 6

Test-Connection 8.8.8.8
Test network connectivity, similar to ping
Test-NetConnection google.com -Port 443
Advanced network diagnostics, test port connectivity
Invoke-WebRequest -Uri https://api.example.com
Send HTTP/HTTPS request, similar to curl
Invoke-RestMethod -Uri https://api.example.com
Send REST API request, auto-parses JSON/XML
Enter-PSSession -ComputerName Server01
Enter remote PowerShell session, similar to SSH
Invoke-Command -ComputerName Server01 -ScriptBlock { Get-Process }
Execute command on remote machine

Scripting 8

$name = "World"
Define variable with $ prefix
$array = 1,2,3; $array[0]
Array definition and index access
$hash = @{ Name = "Tom"; Age = 30 }
Hashtable (dictionary) definition
if ($val -gt 10) { "big" } else { "small" }
Conditional, -gt/-lt/-eq for comparison
switch ($val) { 1 { "one" } default { "?" } }
Switch multi-branch condition
foreach ($item in $items) { $item }
Iterate over array or collection
function Say-Hello { param($name) "Hello $name" }
Define function with parameters
try { 1/0 } catch { "error: $_" } finally { "done" }
Exception handling try/catch/finally

System Management 8

Get-Date
Get current date and time
Set-Date "2026-01-01"
Set system date and time
Get-WmiObject Win32_Processor
Query system info via WMI (CPU)
Get-CimInstance Win32_LogicalDisk
Query disk info via CIM (recommended over WMI)
Format-Table Name,Id -AutoSize
Table format output with auto-sized columns
Format-List Name,Id
List format output, one property per line
Format-Wide Name -Column 4
Wide format output, multi-column display
Get-EventLog -LogName System -Newest 10
View system event log (latest 10 entries)

💡 Tips

  • PowerShell uses Verb-Noun naming convention, e.g. Get-Process, Stop-Service
  • Use Get-Command to find available commands, Get-Help for documentation
  • Pipeline passes objects not text, use Get-Member to inspect object properties
  • Variables use $ prefix, e.g. $var = "hello"
  • Use $profile to customize your PowerShell environment, similar to .bashrc

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Found an error? Report it

Wrong command or description? Open an issue to help us fix it.

Found an error? Report it