Photo by Hassaan Here on Unsplash
So I was knee-deep in a deployment script at some ungodly hour, and the guy on the other end of the Slack message goes, "why are you still on PowerShell 5?" — and honestly, I didn't have a good answer. I just... never migrated. Classic case of "if it ain't broke." But then I actually sat down with PowerShell 7, and I get it now. It's not just a version bump. It's a different experience.
Let me walk you through getting it set up and share some commands and tricks I genuinely use, not just stuff copied off a Microsoft doc.
First — Why PowerShell 7 and Not Just Regular PowerShell?
Here's the thing though: the PowerShell that ships with Windows (Windows PowerShell 5.1) is technically frozen. Microsoft isn't adding features to it anymore. PowerShell 7 is the cross-platform, open-source version — it runs on Windows, Mac, and Linux — and it gets actual updates. It's built on .NET 8 now, which means better performance and a ton of modern language features that 5.1 just doesn't have. Things like ForEach-Object -Parallel, pipeline chains with && and ||, and null-coalescing operators. Stuff that makes your scripts actually readable.
Also worth knowing: both versions can coexist on the same machine. You're not blowing anything up by installing 7.
How to Download and Install PowerShell 7
The fastest way on Windows? Just run this in your existing PowerShell or even CMD:
winget install --id Microsoft.Powershell --source winget
That's it. Winget handles the download and install. If you don't have winget yet — which, come on, update Windows — you can grab the MSI directly from the GitHub releases page. Just look for the latest stable release and grab the win-x64.msi file.
On macOS it's just as easy:
brew install --cask powershell
And on Ubuntu/Debian Linux:
sudo apt-get install -y powershell
After install, you launch it with pwsh — not powershell. That's a thing people miss and then wonder why they're still on version 5. Quick sanity check once you're in:
$PSVersionTable
Should show PSVersion 7.x.x. If it shows 5.1, you typed powershell instead of pwsh. Happens more than I'd like to admit.
The PowerShell Commands I Actually Use Constantly
Alright, here's where I'll be real with you — most PowerShell command lists are bloated. So I'm just going to share the stuff that comes up in real work.
Check and set your execution policy first. If you're on a fresh install and trying to run scripts, you'll hit a wall immediately. The execution policy is why. Fix it like this:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Don't go Unrestricted on a work machine. RemoteSigned is the sweet spot — local scripts run fine, downloaded ones need a signature. I've seen too many people just blast it to Unrestricted and then wonder how something sketchy got executed.
Set an environment variable without rebooting:
[System.Environment]::SetEnvironmentVariable("MY_VAR", "my_value", "User")
The third argument matters — "User" persists for your profile, "Machine" is system-wide (needs admin), and "Process" is just for the current session. PowerShell set environment variable questions come up constantly and this is the one that actually sticks around after you close the terminal.
Parallel processing — this is a PowerShell 7 exclusive and it's a game changer:
1..10 | ForEach-Object -Parallel { Start-Sleep 1; "Done: $_" } -ThrottleLimit 5
In PowerShell 5, that would take 10 seconds. In 7, it takes 2. When you're processing a list of servers or files, this matters a lot.
A Couple of Insider Tricks Worth Knowing
One thing that took me way too long to figure out — you can use && and || in PowerShell 7 just like bash. So instead of nested if-statements to check if a command succeeded, you can write:
git pull && npm install && npm run build
If git pull fails, it stops. No more writing three separate steps with error checking. This alone makes PowerShell scripting way more pleasant for people who work across both Linux and Windows environments.
The other one — and this is genuinely underused — is $? combined with the null-coalescing assignment operator ??=:
$config = $null
$config ??= Get-Content ".\default-config.json" | ConvertFrom-Json
Only runs the right side if $config is null. Saves you from writing verbose if-blocks everywhere. It's one of those quality-of-life things that PowerShell 5 just didn't have and you don't realize you missed it until you start using it.
(Side note — if you're comparing PowerShell vs Command Prompt for any kind of scripting or automation work, there's no real contest. CMD is for quick one-liners and navigating folders. The moment you need to handle objects, loop through data, or talk to an API, you want PowerShell. Not even close.)
One More Setup Thing — Check Your Version Anytime
Bookmark this command. You'll use it more than you expect, especially when troubleshooting why something works on one machine and not another:
pwsh --version
Run it from CMD or any terminal to see what's installed at the system level. Different from running $PSVersionTable inside a session because it doesn't require launching pwsh first.
Anyway — hope this saves you the 2am confusion. Get PowerShell 7 installed, set your execution policy properly, and start using the parallel processing features. That last one alone will make you look like a wizard in front of your team.
๋๊ธ
๋๊ธ ์ฐ๊ธฐ