PowerShell Commands Cheat Sheet
Quick reference for PowerShell cmdlets: discovery, file/system, pipeline filtering and selection, networking, remote sessions and modules — with common parameters and practical examples.
34 commands
Discovery & Help
Get-Command [<name>]Discover commands by name, alias, or wildcard — really the 'man' of PowerShell.
-Module <module>; -Noun / -Verb; -ParameterType; -All
Get-Command -Noun Service | Format-Table Name, ModuleGet-Help <cmdlet> [-Examples|-Detailed|-Full]Show help for a cmdlet: synopsis, syntax, parameters, examples.
-Examples; -Detailed; -Full; -Online open browser; -ShowWindow GUI
Get-Help Get-Process -ExamplesGet-Module [-ListAvailable]List modules loaded into the session (or available for import).
-ListAvailable; -All; -Name filter
Get-Module -ListAvailable | Sort-Object NameNavigation & FS
Set-Location / Get-Location / pwdChange or print the current working directory.
Set-Location C:\projects\app; Get-LocationGet-ChildItem (alias ls/dir)List files and subdirectories (recursively with -Recurse).
-Recurse; -Force hidden; -Filter <pattern>; -File / -Directory; -Depth
Get-ChildItem -Recurse -File -Filter *.log | Sort-Object Length -Descending | Select-Object -First 10New-Item -ItemType File/Directory <path>Create a new file or directory (default: file).
-Force overwrite/create parents; -ItemType File|Directory|SymbolicLink; -Value content
New-Item -ItemType Directory -Path logs/2026 | Out-NullRemove-Item (alias rm/del)Delete files, directories, registry keys, or variables.
-Recurse; -Force; -Confirm:\$false to skip prompts
Remove-Item -Recurse -Force build/, node_modules/Copy-Item / Move-Item / Rename-ItemCopy, move or rename filesystem items.
-Recurse; -Force; -To; -Exclude / -Include filters
Copy-Item -Recurse dist\* \\deploy\shares\app\Get-Content / Set-Content / Add-ContentRead or write file content (Get-Content with -Tail behaves like Unix tail).
-Tail N; -Wait follow; -TotalCount N; -Encoding utf8/ASCII
Get-Content -Path app.log -Tail 50 -WaitTest-Path / Resolve-PathCheck if a path exists (file, dir, registry) or resolve wildcards.
-PathType Container|Leaf; -IsValid
if (Test-Path .\node_modules) { Remove-Item -Recurse .\node_modules }Pipeline & Objects
Where-Object (alias ?)Filter objects in the pipeline by a property or script block.
-Property / -Value pattern match; -Like / -EQ / -GT ...; -CContains / -In
Get-Process | Where-Object { $_.WorkingSet64 -gt 200MB }Select-Object (alias select)Choose specific properties, deduplicate, or expand to N items.
-Property names; -First / -Last N; -Skip N; -Unique; -ExpandProperty
Get-Service | Select-Object Name, Status, StartType | Format-TableForEach-Object (alias %)Perform an action on each object arriving in the pipeline.
-Begin / -Process / -End; -Parallel on PS7+
Get-ChildItem *.csv | ForEach-Object { Import-Csv $_ | Group-Object Level }Sort-Object (alias sort)Sort pipeline objects by one or more properties.
-Property; -Descending
Get-ChildItem | Sort-Object -Property Length -Descending | Select -First 5Group-Object (alias group)Group objects by a property value; `-NoElement` yields just counts.
-Property; -NoElement; -CaseSensitive
Get-Content app.log | Group-Object | Sort-Object Count -DescendingMeasure-Object (alias measure)Compute numeric statistics (count, sum, min/max/avg) for a property.
-Sum / -Average / -Minimum / -Maximum; -Line / -Word / -Character for text
Get-ChildItem -File -Recurse | Measure-Object -Property Length -SumFormatting
Format-Table / Format-List (ft / fl)Render pipeline objects as a table or a list — for display only.
-AutoSize; -Wrap; -GroupBy; -Property subset
Get-Process | Format-Table Name, Id, @{n='Mem(MB)';e={[Math]::Round($_.WorkingSet64/1MB,1)}} -AutoSizeOut-File / Set-Content / Tee-ObjectWrite output to a file; Tee-Object writes both to a file and the pipeline.
Get-Service | Tee-Object -FilePath services.txt | Where-Object { $_.Status -eq 'Running' }Strings & Variables
Select-String (alias sls)Grep equivalent — find lines matching a pattern (regex-aware).
-Path; -Pattern; -SimpleMatch; -CaseSensitive; -Context N
Select-String -Path src\**\*.ts -Pattern 'TODO' -CaseSensitive:\$falseSet-Variable (alias set/sv)Define a session or environment variable.
-Name; -Value; -Scope Global|Local|Script; -PassThru
Set-Variable -Name regions -Value @('eastus','westus') -Scope GlobalGet-Variable / $env:List or read variables; read/write process environment via $env: drive.
$env:DATABASE_URL = 'postgres://localhost/dev'; Get-Variable | Out-GridViewGet-Alias / Set-AliasList or define custom shortcuts for cmdlets.
Set-Alias -Name grep -Value Select-String -Option ReadOnly -Scope GlobalProcesses & Services
Get-Process / Start-Process / Stop-ProcessInspect, start or stop local processes (Stop-Process = kill).
-Name; -Id; -FileVersionInfo; -PassThru; -Force for kill
Get-Process node | Sort-Object -Property WorkingSet64 -Descending | Select -First 5Get-Service / Start-Service / Stop-ServiceInspect, start or stop Windows services.
-Name; -DisplayName; -Status Running|Stopped
Get-Service | Where-Object Status -eq Stopped | Format-Table Name, StartupTypeNetworking
Test-NetConnection <host>Diagnose TCP connectivity, latency, and (with -Port) reachability.
-Port; -InformationLevel Detailed; -DiagnoseRouting
Test-NetConnection api.example.com -Port 443Invoke-WebRequest / Invoke-RestMethodHTTP client (RestMethod parses JSON straight into objects).
-Method GET/POST/PUT/DELETE; -Headers @{...}; -Body (json); -OutFile path; -SkipHttpRedirect; -UseBasicParsing
Invoke-RestMethod -Uri https://api.github.com/repos/powershell/powershell/releases/latest | Select-Object tag_name, html_urlResolve-DnsName / Get-NetIPAddressResolve DNS records and inspect local IP configuration.
-Type A/AAAA/MX/CNAME; -Server 8.8.8.8; -AddressFamily IPv4/IPv6
Resolve-DnsName example.com -Type MXRemote & Module
Enter-PSSession / Invoke-CommandStart or run a command on remote machines (WinRM / SSH).
-ComputerName / -HostName; -Credential; -ConfigurationName; -FilePath
Invoke-Command -ComputerName web01,web02 -FilePath .\deploy.ps1Import-Module / Find-Module / Install-ModuleLoad a module into the session or fetch it from a repository.
-Force reload; -Scope Global/CurrentUser; -AcceptLicense; -AllowClobber
Install-Module -Name Az -Scope CurrentUser -AcceptLicenseGet-Module / Remove-ModuleList loaded modules or unload one from the session.
Get-Module | Format-Table Name, Version, ExportedCommands.CountSystem
Get-Date / Set-DateRead or change the current date/time with rich formatting.
-Format; -UFormat; -DisplayHint; -Culture
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'Get-CimInstance Win32_OperatingSystemHardware/system info via CIM/WMI (memory, disk, OS, BIOS, etc.).
-ClassName; -ComputerName; -Filter query
Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select DeviceID, @{n='FreeGB';e={[Math]::Round($_.FreeSpace/1GB,2)}}Get-History / Invoke-History (alias h/r)Replay recently run commands in the current session.
-Count N; -Id N to rerun a specific entry
Get-History | Where-Object CommandLine -like 'Get-*' | Invoke-History$PROFILE / Update-HelpEdit your profile (startup script) and refresh cmdlet help.
notepad $PROFILE; Update-Help -ForceCheatsheet version 1.0.0
Covers PowerShell 7+