$ command-helper

PowerShell

Finding commands and help, files and processes, filtering objects, environment variables and web requests.

Requires Google sign-in

Getting around

Find a command
Get-Command *<keyword>*
Help with examples
Get-Help <cmdlet> -Examples
What properties an object has
Get-Process | Get-Member
PowerShell version
$PSVersionTable

Files

List files recursively by mask
Get-ChildItem -Recurse -Filter *.log
Search text in files (grep)
Select-String -Path *.log -Pattern '<pattern>'
Follow a log file (tail -f)
Get-Content app.log -Wait -Tail 50
Largest files in a folderadvanced
Get-ChildItem -Recurse -File | Sort-Object Length -Descending | Select-Object -First 10 FullName, Length

Processes, services, network

Top processes by CPU
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
Stop a process by name
Stop-Process -Name <name> -Force
Who listens on a port
Get-NetTCPConnection -LocalPort <port> | Select-Object LocalPort, State, OwningProcess
Is a TCP port reachable
Test-NetConnection <host> -Port <port>
Restart a Windows service
Restart-Service -Name <windows_service>

Data and web

Filter and select objects
Get-Service | Where-Object Status -eq 'Running' | Select-Object Name, DisplayName
Call a JSON API (parsed automatically)
Invoke-RestMethod <url>
Export objects to CSV
Get-Process | Export-Csv processes.csv -NoTypeInformation
Set an environment variable for the session
$env:<env_var> = 'value'
Allow running local scriptsadvanced
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned