← Knowledge Base
PowerShellReference note1 min read · updated 2026-11-27

Useful PowerShell admin one-liners

Disk space, uptime, installed updates, top memory users and open ports.

powershelladminone-liners
Get-Volume | Select DriveLetter,FileSystemLabel,@{n='FreeGB';e={[math]::Round($_.SizeRemaining/1GB,1)}},@{n='SizeGB';e={[math]::Round($_.Size/1GB,1)}}
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime        # uptime
Get-HotFix | Sort InstalledOn -Descending | Select -First 10                 # recent updates
Get-Process | Sort WorkingSet -Descending | Select -First 10 Name,@{n='MB';e={[int]($_.WS/1MB)}}
Get-NetTCPConnection -State Listen | Sort LocalPort | Select LocalAddress,LocalPort,OwningProcess
Get-ComputerInfo | Select WindowsProductName,WindowsVersion,OsBuildNumber
Test-NetConnection example.org -Port 443
Get-Service | Where Status -eq 'Stopped' | Where StartType -eq 'Automatic'

Run elevated where a command needs it. Pipe to Out-GridView for a quick sortable window, or Export-Csv to save the result.