PowerShell Cheatsheet
Free searchable PowerShell cheatsheet: the pipeline, files, services, networking, operators, functions, error handling and remoting.
Frequently asked questions
What is the difference between Windows PowerShell and PowerShell 7?
Windows PowerShell 5.1 is built into Windows and is no longer getting new features. PowerShell 7 is installed separately, runs on Windows, macOS and Linux, and is where new features go. Most scripts run in both, but a few older Windows modules only work in 5.1.
Why does PowerShell use -eq instead of ==?
In PowerShell, > and < redirect output to files, as in other shells, so comparisons use named operators instead: -eq, -ne, -gt, -lt, -ge and -le. They ignore case by default; add a c (for example -ceq) to compare with case.
Why won't my script run?
On Windows, the execution policy may block scripts. Set-ExecutionPolicy RemoteSigned -Scope CurrentUser allows your own scripts, and signed scripts from the internet, without admin rights. Execution policy is a safety setting, not a security boundary.