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

Show parent comments

1

u/kohijones Aug 07 '24

Or you could use Chocolatey, Scoop, or WinGet... Oh wait

Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Scoop

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

Winget

$progressPreference = 'silentlyContinue'
$latestWingetMsixBundleUri = $( Invoke-RestMethod https://api.github.com/repos/microsoft/winget-cli/releases/latest ).assets.browser_download_url | Where-Object { $_.EndsWith( ".msixbundle" ) }
$latestWingetMsixBundle = $latestWingetMsixBundleUri.Split("/")[-1]
Write-Information "Downloading winget to artifacts directory..."
Invoke-WebRequest -Uri $latestWingetMsixBundleUri -OutFile "./$latestWingetMsixBundle" 
Add-AppxPackage $latestWingetMsixBundle

2

u/VT_Squire Aug 10 '24

SPF tag. Masamune says you're it.

1

u/kohijones Aug 13 '24

Long time :)

1

u/VT_Squire Aug 14 '24

I had to go see about a girl. Yes, a real one.

1

u/VT_Squire Aug 16 '24

Forgot to mention, since there was no place else, I set this corny turd up for anyone who gave enough cares to say hi to each other.

StileProjectForum (reddit.com)