Skip to content
💻 🧠 Code 1001 > 📑 Cheat Sheets > 📚 PowerShell Cheat Sheets > Update PowerShell to the latest version.

Update PowerShell to the latest version.


Update with Winget

The Windows Package Manager, winget, is the modern and recommended way to install and update software on Windows, including PowerShell.

Check available PowerShell versions:
Open PowerShell and run the following command to see all available versions for installation:

winget search Microsoft.PowerShell

Install the latest stable version:
To install the latest stable version of PowerShell, execute:

winget install --id Microsoft.PowerShell --source winget

This command will find and install the latest available version of PowerShell.


Update with a one-line command

You can use a command that downloads and runs the official PowerShell installation script from Microsoft.

For simplicity and speed, enter the following command in PowerShell:

powershell iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

This command uses Invoke-RestMethod (alias irm) to download the script and Invoke-Expression (alias iex) to execute it. The -UseMSI parameter specifies the use of the MSI installer.


Check PowerShell version

After the installation process is complete, you can check the current version of PowerShell to make sure the update was successful.

  1. Open a new PowerShell window.
  2. Run the following command:
    powershell $PSVersionTable
    In the output, you will see the new version in the PSVersion line.

It is worth noting that Windows PowerShell (versions up to 5.1) and PowerShell Core (versions 6 and newer) are different platforms and can be installed in parallel. The executable for modern versions of PowerShell is called pwsh.exe.


Leave a Reply

Your email address will not be published. Required fields are marked *