Copy · paste · run

PowerShell one-liners you can actually paste.

Ready-to-run PowerShell for the Windows admin tasks you actually do — services and processes, AD accounts, event logs, large files, network and firewall — each with what it does, when you need admin, and how to export the result.

15 recipes

Why this exists

You know the cmdlet exists. You don't remember the exact pipeline.

PowerShell can do almost anything on a Windows box, but the exact Where-Object / Select-Object / calculated-property pipeline never sticks — so you re-derive it or paste a half-right snippet. psoneliner.pages.dev is a library of focused, copy-paste one-liners for real admin tasks, each with a one-line explanation, the elevation it needs, and the gotchas (slow Win32_Product, RSAT for AD, fast event-log filtering).

How it works

Find the task, copy the line, run it

  1. Pick a recipe. Browse by area in the full recipe list.
  2. Copy the one-liner. Every command has a one-click copy button.
  3. Run it (elevated if noted) and pipe to Export-Csv if you need the result in a file.

FAQ

Frequently asked questions

Are these PowerShell one-liners free?

Yes. Every recipe on psoneliner.pages.dev is free to read and copy, with no account, paywall, or sign-up. Some outbound links (for example to admin tools) may be affiliate links, which never change the price you pay.

Windows PowerShell 5.1 or PowerShell 7?

Both. These one-liners use cmdlets present in Windows PowerShell 5.1 (built into Windows) and PowerShell 7+. Where a cmdlet or operator only exists in 7+ (like Get-Uptime or the ternary operator), the recipe notes it.

Do I need to run PowerShell as Administrator?

Some do — managing services, reading the Security event log, or changing firewall rules need an elevated prompt. Right-click PowerShell and "Run as administrator" (or run "Start-Process powershell -Verb RunAs"). Each recipe notes when elevation is required.

I get "Get-ADUser is not recognized" — why?

Active Directory cmdlets live in the ActiveDirectory module, part of RSAT (Remote Server Administration Tools). Install it ("Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0") or run the recipe from a domain controller / management box.

Why use the registry for installed software instead of Win32_Product?

Get-CimInstance Win32_Product is slow and can trigger an MSI self-repair on every app it touches. Reading the Uninstall registry keys is fast and safe — that is what the "installed software" recipe uses.

How do I save the output to a file?

Pipe to Export-Csv for a spreadsheet ("... | Export-Csv out.csv -NoTypeInformation"), to Out-File for plain text, or to ConvertTo-Json. The "export" recipe shows each, plus Format-Table for clean on-screen output.