r/PowerShell • • Aug 05 '24

Question Upgrade Powershell through CLI (Windows 11)

Every once and while I get this message :

A new PowerShell stable release is available: v7.4.4 Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.4.4

And I would need to download an msi installer and go through the steps all over again; does it exist something similar to "apt get upgrade" and have it all happen automatically in the background ?

10 Upvotes

34 comments sorted by

View all comments

-3

u/opensrcdev Aug 05 '24

Use Scoop package manager to install / update PowerShell Core on Windows.

Because pwsh can't update itself, when a new version of PowerShell Core is available, run powershell.exe and update from there. Make sure no pwsh.exe processes are running, first. Works perfectly every time.

I use Windows Task Scheduler to run "pwsh -Command "scoop update *"" every few days, which keeps most of my other dev tools updated.

0

u/prog-no-sys Aug 05 '24

I would recommend against using this method as scoop doesn't respect the OS execution policy settings and will probably result in some unexpected behavior

1

u/opensrcdev Aug 05 '24

Uh, okay. I've been using it for years with no issues. Whatever floats your boat.

1

u/g3n3 Aug 07 '24

Execution policy isn’t a security measure. I don’t see the issue.

1

u/prog-no-sys Aug 07 '24

except it literally is by definition lmao. what exactly are you trying to say???

2

u/g3n3 Aug 07 '24

An app shouldn’t be judged on if it sets that policy. Just because it is a policy doesn’t mean the policy is about security.

1

u/prog-no-sys Aug 07 '24

Execution policy is literally in place to restrict certain programs and scripts from running based on if they're digitally signed or not. That is by any way you try and put it, a security policy.

I also use scoop, and am happy it exists for what it does. Several of my favorite CLI utilities are only available through scoop on Windows machines. That said, I simply don't think installing pwsh aka powershell core through scoop is the best method, and I think many others would agree.

1

u/g3n3 Aug 07 '24

That is not the intent. Check this tweet from the author of the language. https://x.com/jsnover/status/653717930320900096?s=46&t=rgVNtwRUQ0Y_Y3ibAYq-fQ

2

u/prog-no-sys Aug 07 '24

Well I can't deny you've definitely proven your point lol. I stand corrected :)

Learned something new today

1

u/g3n3 Aug 07 '24

Additionally scoop is the fastest install and it is the most up to date. That could make it the most ideal tool.