Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade PowerShell version

Lately, firing up PowerShell, I noticed that there is a phrase that says:

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

So why not trying it following the actual Microsoft documentation:

  1. I run $PSVersionTable and the version installed is 5.1
  2. I run winget search Microsoft.PowerShell and it says that version 7.2 is available as well as the 7.3 preview version
  3. I run winget install --id Microsoft.Powershell --source winget and version 7.2 is installed
  4. I run $PSVersionTable again and I'm still on 5.1

enter image description here

Let's try to install it through dotnet:

  1. I run dotnet tool install --global PowerShell and the terminal says Tool 'powershell' (version '7.2.6') was successfully installed.
  2. I run $PSVersionTable and I'm still on 5.1

enter image description here

I'm following the current Microsoft documentation, where am I wrong?

like image 209
Francesco Mantovani Avatar asked Feb 05 '26 19:02

Francesco Mantovani


2 Answers

Powershell 7 (core) is its own application. Search for pwsh.exe and run that

like image 68
Fitzgery Avatar answered Feb 07 '26 09:02

Fitzgery


To upgrade Poweshell version 7:

winget upgrade --id Microsoft.PowerShell

Sources:

  • https://www.alitajran.com/install-update-powershell/#h-update-powershell-7
  • https://learn.microsoft.com/en-us/windows/package-manager/winget/upgrade
like image 28
atelesjr Avatar answered Feb 07 '26 09:02

atelesjr