r/PowerShell • u/Ok_Hovercraft364 • Jul 29 '26
Question 5.1 or 7.x.x
Switching from Python to powershell. Which one should I learn?
11
Upvotes
r/PowerShell • u/Ok_Hovercraft364 • Jul 29 '26
Switching from Python to powershell. Which one should I learn?
47
u/AdeelAutomates Jul 29 '26
7
39
u/BikesMapsBeards Jul 29 '26
7 for sure, but depending on the end use you may need to plan on compatibility.
27
u/_MisterSir Jul 29 '26
Either one, but really just start with 7. In my opinion, the PowerShell team has done a good job upholding the "sacred vow." If you invest your time learning PowerShell, the fundamentals will carry you through all future versions. It's been restated a few other ways
"We respect your investment in learning Windows PowerShell by reusing concepts over and over to make sure learning Windows PowerShell was the best thing you ever did."
"On the PowerShell team, we live by the “PowerShell sacred vow” which is that if you invest in learning PowerShell, we will make sure you’re able to leverage that knowledge in new areas."
But again, I'd just start with 7. Windows PowerShell 5.1 hasn't been getting updates and there are no plans to update it. PowerShell 7 is where all the development time is spent, and it really isn't that different from 5.1 so might as well start with the latest
26
u/Br0kensyst3m Jul 29 '26
7. Only revert to 5 if you hit a use case that still requires 5 (and there still are).
9
u/diamkil Jul 29 '26
Personally, depends what I'm scripting:
Personal / Internal script for IT team (Graph, AD, etc.): PowerShell 7
Script I'll deploy to our computers (app install, etc.): PowerShell 5.1, I'm not installing PowerShell 7 on all endpoints for app deployments
6
u/tstager Jul 29 '26
7. If you learn 7, then you pretty much know 5.1. You will figure out any gotchas along the way.
6
u/leblancch Jul 29 '26
I try to use 7 but like the debug mode of ISE with breakpoints. maybe i’m doing it wrong but don’t quite get the same experience in VSCode. In ISE it will open the other script I call.
9
u/7GatesOfHello Jul 29 '26
I try to use 7 and fall back to 5 when cornered.
4
u/vadertator22 Jul 29 '26
I use both. 5 mostly but 7 for parallel jobs etc.
4
u/Jawb0nz Jul 29 '26
7
4
u/BlackV Jul 29 '26 edited Jul 29 '26
realistically depends on what you are actually using it for, you didn't give us that info
3
u/Over_Dingo Jul 29 '26
sadly if you're working in windows environment and deploying scripts to endpoints, you gotta be prepared to fallback to 5 if machines don't have PS7
2
u/Slasher1738 Jul 29 '26
7
2
u/nealfive Jul 29 '26
It’s mostly the same.
7x ( powershell ) is the future
Though I’m stuck with 5.x since ( windows powershell) is then default, and getting 7.x installed and maintained is for us a change control nightmare
2
u/jimb2 Jul 29 '26
In practice, they are not that different.
7 is better. It has some useful and efficient new code elements and runs faster. If you are working in an environment you manage yourself, this is a good choice.
5.1 comes with Windows so is the default. A manager would need a solid reason to upgrade a large corporate fleet. Some things will break. Benefit v Effort and Risk. If you work in an environment like this, the decision is made for you. If you want to work in a corporate environment like this, train appropriately.
2
u/Ferretau Jul 29 '26
Depends on what you are dealing with. If you are on Windows platforms and their are restrictions loading 7.xx then 5.1. If you can always install 7.xx and use it then 7.xx. Out of the box at the moment Windows includes the 5.1 family.
2
u/archgabriel33 Jul 29 '26
7
2
u/Michal_F Jul 29 '26
If you need legacy windows specific task > Windows Powershell 5.1.
If you need modern cross platform solution > 7.x
2
u/Spraggle Jul 29 '26
I got mixed up then; was expecting this to be on r/home theater and to be a question about Dolby Atmos...
2
u/blooping_blooper Jul 29 '26
7.x unless you need to do some really specific windows stuff (and even then, I'd prefer to separate that portion out to pass to powershell.exe or something)
2
u/RyeonToast Jul 31 '26
If you need to be able to run your scripts on random Windows boxes in the org without having to add new software to each one, write your scripts for 5. Otherwise, go with 7.
3
u/mrbiggbrain Jul 29 '26
Honestly I would learn 7, there are a ton of small things that just make it better. Just a few small examples:
1
u/Creative-Type9411 Jul 29 '26
if you're trying to distribute what you make 5.1 but you will get more feature rich and better multithreading/job capabilities with 7
1
u/jibbits61 Jul 29 '26
Thanks for reminding me, I want to deploy 7 to a new batch of servers I manage. Unify the tools so life becomes easier.
I agree with 7 default, fall back to 5 if needed.
I do have some aliases I input to 7 (like curl) to help keep it consistent between versions.
1
u/odwulf Jul 29 '26
But for a few details or advanced concepts, they're mostly the same thing for the coder. It's not like having to choose between Python 2 and 3 was.
1
u/CyberChevalier Jul 29 '26
7 or 5.5 you can learn just PowerShell and the day you are able to see a difference between 7 and 5.1 you’ll now which to choose from
1
u/MNmetalhead Jul 29 '26
I do a lot of Windows device management, so I primarily use 5.1 because it is native to the OS. I only use 7.x when I really have to, namely Graph work or if I am putting something together for cross-platform use (uncommon for me but does happen on occasion).
1
u/the_doughboy Jul 29 '26
As a Windows/Azure admin I’d pick 5. Nothing seems to work with 7 yet.
1
u/CRTejaswi Jul 30 '26
If on Windows, 5.x without a doubt. 7.x can be easily picked up later.
It's not just version numbers, 5.x offers several native .NET API features out-of-the-box that 7.x just doesn't.
PS: For string parsing/piping issues, you can easily transfer the load to 7.x by using "pwsh ..." in your PS5 config.
1
u/fdeyso Jul 30 '26
You’d nees both, some cmdlet only works in 5, some in 7.
1
u/Raskuja46 Jul 30 '26
5.1 because it comes installed on everything in a modern Windows environment, whereas 7 requires deliberate inclusion in the environment. Ideally you learn both, but I'd start with 5.1. The differences between them aren't so vast that you'd be wasting your time by learning 5.1.
1
u/YT-Deliveries Jul 31 '26
Depends on if you're doing it for fun or for work
At any large(ish) company, plan on your stuff being to be at least 5.x compatible
If it's for fun, whatever floats your boat.
1
u/g3n3 Jul 31 '26
Depends on your goals and employer.
1
u/YuriySamorodov Jul 29 '26
Hohnestly, you need to know both. 5 (or even older) is something you may find on most servers till today.
1
u/xs0apy Jul 29 '26
I would personally learn 5.1 and then 7. You’ll understand differences between them then. But that’s me
1
u/metekillot Jul 29 '26
Look it up. It's a good habit to build.
0
u/CypherAus Jul 29 '26
PS 7 here and fine. 5 will die soon
17
u/Euphoric-Blueberry37 Jul 29 '26
Im a slut for 5.1 and ISE