←Back to Guides
โšกPowerShell Automationโฑ๏ธ 12 min read•Updated October 2026

PowerShell 7 & Sysadmin Master Cheat Sheet: Pipelines, Cmdlets & Automation

The ultimate modern PowerShell 7 guide for Windows and cross-platform sysadmins: object pipelines, high-speed filtering, file hashes, network diagnostics, and administrative one-liners.

#PowerShell#Windows#Sysadmin#Scripting#Automation#CLI#DevOps

1. The Object Pipeline & Filtering Magic

Unlike traditional Unix shells that pass plaintext streams, PowerShell passes **rich structured .NET objects** down the pipeline. This means you never have to parse text with `awk` or `sed` to extract properties. **Pipeline Core Utilities:** - `Where-Object` (alias `?`): Filters objects based on properties. - `Select-Object`: Picks specific properties or limits results. - `ForEach-Object` (alias `%`): Executes an action for each element. - `Sort-Object`: Sorts output by any property (ascending or descending).
Find Top 10 RAM-Hungry Processes
Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 10 -Property Name, @{Name="RAM (MB)"; Expression={[math]::round($_.WorkingSet64 / 1MB, 2)}}

Sorts processes by physical memory and calculates human-readable megabytes.

Filter Stopped Auto-Start Services
Get-Service | Where-Object { $_.StartType -eq "Automatic" -and $_.Status -ne "Running" }

Identifies critical background services that failed to boot on startup.

2. File Management & Checksum Verification

Commands for locating files, inspecting sizes, and calculating cryptographic hashes:
Find Files Larger Than 500MB Recursively
Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue | Where-Object Length -gt 500MB | Select-Object FullName, @{N="Size (GB)"; E={[math]::round($_.Length / 1GB, 2)}}

Searches drives for storage-consuming files while suppressing permission errors.

Compute SHA-256 Checksum of Any File
Get-FileHash -Path .\installer.exe -Algorithm SHA256 | Format-List

Calculates the official SHA-256 hash to verify binary integrity.

Search File Contents with Select-String (Grep Equivalent)
Select-String -Path .\logs\*.log -Pattern "FATAL|EXCEPTION" -Context 2,2

Searches log files with regex matching and outputs 2 lines of before/after context.

3. Network & Port Diagnostics (Test-NetConnection)

Modern replacements for legacy `ping`, `tracert`, and `telnet`:
Test TCP Port Connectivity (Telnet Alternative)
Test-NetConnection -ComputerName "api.github.com" -Port 443

Performs full TCP handshake test and reports TcpTestSucceeded: True/False.

Detailed Traceroute with RTT Latency
Test-NetConnection -ComputerName "1.1.1.1" -TraceRoute

Maps the IP routing hops and network latency across internet gateways.

Query DNS Records (Dig Equivalent)
Resolve-DnsName -Name "mayonlinetools.com" -Type A

Fetches IPv4 A records, TTL values, and nameserver responses.

4. Essential Administrator One-Liners

Quick automation snippets for daily IT administration and troubleshooting:
Flush Windows DNS Resolver Cache
Clear-DnsClientCache

Immediately purges cached DNS records without restarting networking.

Fetch JSON API Data with Type Coercion
$data = Invoke-RestMethod -Uri "https://api.github.com/zen"
Write-Host "Zen Quote: $data"

Calls REST endpoints and automatically deserializes JSON into native PowerShell objects.

Set Safe Execution Policy for Local Scripts
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force

Allows executing local automation scripts while blocking unsigned internet downloads.

๐ŸŽ“Explore More Guides

โœจ