Copy · paste · run
PowerShell one-liners you can actually paste.
Ready-to-run PowerShell for the Windows admin tasks you actually do — services, processes, AD, event logs, files, network — each with what it does and how to export it.
15 recipes
- System Find Top CPU / Memory Processes with PowerShell (and Kill One) List the processes using the most CPU or RAM with PowerShell, show memory in MB, and stop a process by name or PID. Copy-paste. 3 min →
- System List, Start, Stop & Restart Windows Services with PowerShell Find services, see what's running or stopped, restart one, and set startup type — with PowerShell. Copy-paste (some need admin). 3 min →
- System Get System Info with PowerShell (OS, CPU, RAM, Serial, Uptime) Pull OS version, CPU, total RAM, BIOS serial and uptime with PowerShell using Get-CimInstance. Copy-paste. 3 min →
- Users & AD Find Locked-Out Active Directory Accounts with PowerShell List locked-out AD accounts with Search-ADAccount, see recent lockouts, and unlock an account. Needs the RSAT ActiveDirectory module. Copy-paste. 3 min →
- Users & AD List AD Users by Password Expiry Date with PowerShell Show when each Active Directory user's password expires, find passwords expiring soon, and list never-expires accounts. Needs the ActiveDirectory module. Copy-paste. 3 min →
- Users & AD List & Manage Local Users and Groups with PowerShell List local users, see who's in Administrators, create a user, and add it to a group with the Microsoft.PowerShell.LocalAccounts cmdlets. Copy-paste (admin). 3 min →
- Files Bulk Rename Files with PowerShell Rename many files at once with PowerShell — change extensions, add a prefix, replace text, and number files sequentially. Copy-paste. 3 min →
- Files Find the Largest Files in a Folder with PowerShell List the biggest files under a path with PowerShell, show sizes in MB/GB, and find old or specific-type files to clean up. Copy-paste. 3 min →
- Files Search File Contents Recursively with PowerShell (grep) Use Select-String to grep file contents recursively, show line numbers, match with regex, and list only matching filenames. Copy-paste. 3 min →
- Network List & Add Windows Firewall Rules with PowerShell Query Windows Firewall rules, find what's allowed on a port, add an inbound allow rule, and enable/disable rules. Copy-paste (admin). 3 min →
- Network IP Config, Test-Connection & Open Ports with PowerShell Show IP addresses, test connectivity and a TCP port, list listening ports, and flush DNS with modern PowerShell net cmdlets. Copy-paste. 3 min →
- Event logs Query the Windows Event Log with PowerShell (Get-WinEvent) Read the Windows event log fast with Get-WinEvent and FilterHashtable — by log, level, event ID and time range. Copy-paste. 3 min →
- Event logs Find Failed Logons with PowerShell (Security Event 4625) List failed logon attempts from the Security log with Get-WinEvent, extract the account and source IP, and count attempts by user. Copy-paste (admin). 3 min →
- Output & export Export PowerShell Output to CSV (and Format a Table) Save any PowerShell output to CSV, plain text or JSON, and format clean on-screen tables with Format-Table and calculated columns. Copy-paste. 3 min →
- Output & export List Installed Software with PowerShell (and Export to CSV) List installed programs fast by reading the Uninstall registry keys (not the slow Win32_Product), find one app, and export to CSV. Copy-paste. 3 min →
You know the cmdlet exists. You don't remember the exact pipeline.
Each recipe is a focused, copy-paste one-liner for a real admin task, with a one-line explanation, the elevation it needs, and the gotchas.
FAQ
Are these PowerShell one-liners free?
Yes. Every recipe is free to read and copy, with no account or paywall.
PowerShell 5.1 or 7?
Both. Recipes use cmdlets in Windows PowerShell 5.1 and 7+, and note any 7-only feature.
Do I need to run as Administrator?
Some do (services, Security log, firewall). Each recipe notes when an elevated prompt is required.
Get-ADUser not recognized?
AD cmdlets need the ActiveDirectory module (RSAT). Install it or run from a management box.