How to upgrade Windows PowerShell to v7.2.6
Asked Answered
J

1

6

I am using Microsoft Window1 Home on a 64 bit computer, and am using Windows PowerShell 7.2.5

I just opened my PowerShell today and it told me "A new PowerShell stable release is available: v7.2.6 Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.2.6"

I looked at the release page but could not figure out from how to update it from the webpage.

I then tried the command winget upgrade Microsoft PowersShell but got the error message Found a positional argument where none was expected: `PowerShell`

Any help in figuring out how to update this PowerShell would be greatly appreciated!

Other info about my computer: Version: 10.0.22000 Build 22000 System Model: Inspiron 7570 Processor: Intel(R) Core(TM) i5-8250U CPU

Jauch answered 16/8, 2022 at 17:56 Comment(0)
A
9

Why use wget?

Just directly download the MSI (installer) locally and install it.

If you want to do this via code directly in PS, then do this:

Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI" 

When you install the latest version, it will ask you to allow for automatic updates via Windows Update for all future updates.

Areola answered 16/8, 2022 at 18:38 Comment(3)
This was really helpful and worked perfectly! Thank you! How did you find this out however? I was trying to google an answer and did not come across anything like this.Jauch
No worries, glad it was a resolution for you. As for the posted solution. This approach has been on the web for a few years now. Since PSv6. I've had this in my launch profile for a very long time as a check for the new version and it will launch if there is one. Yet, with the latest release, and the WU integration, I've commented it out. I keep it around as this question does come up from time to time. BTW, no need for 'Wget', as PowerShell has had a package manager for a while now. PowerShellGet, and well, it uses 'Wget' under the covers anyway. There are other reasons to use 'Wget though.Areola
There have been/are other approaches as well. For Example: How to Install and Update PowerShell 7, and this,How to keep PowerShell Core up to date using Windows Terminal, but again, after the Microsft changes for updates, it mostly moot. As for WGet thing, read up on PowerShellGet.Areola

© 2022 - 2024 — McMap. All rights reserved.