Install or update PowerShell to make sure you are always running the latest version.
Published: Apr 30, 2025
Use this guide to help you check your current PowerShell version, update PowerShell from one version to another, run two versions side by side in Windows Terminal, and update PowerShell to the latest revisions.
Windows PowerShell has been an essential tool in the IT Pro’s toolbelt. PowerShell 5.1 was introduced back in 2016 with Windows 10 version 1607 and Windows Server 2016. It has evolved significantly from the 5.x release to the latest PowerShell 7.x, bringing performance improvements, new features, more cmdlets, and better compatibility, especially for scripts. Another benefit for PowerShell 7 is cross-platform support for additional operating systems – there is native support now in macOS and Linux.
Before we delve into the two major version branches of PowerShell, let’s show you how to quickly determine what version you have installed in the shell session you have open.
The first line showing the ‘PSVersion’ is the source of truth. Mine shows ‘5.1.22621.4435’. This can be simplified to ‘5.1’. The process using PowerShell 7.x is the same. I’ll show you the output a little later on.
For the best results, it is recommended to update PowerShell 7 using the same method that was used during its installation. You can determine that by using the $PSHOME variable. Let me show you.
Because the value shown here ends in ‘…\PowerShell\7’, that tells us it was installed as an MSI package or with winget.
Let me demonstrate the most efficient method to update PowerShell 7 version to the latest version available.
We’re running PowerShell version 7.5.0 and we know that there is a small PowerShell update available – 7.5.1. On this system, PowerShell 7 was installed from the Web (MSI file). But let’s see if we can use winget to our advantage.
winget search Microsoft.PowerShell
The first result is what we want. Let’s try it.
winget upgrade Microsoft.PowerShell
Ahh, there is no installed package. This is a result of the fact that my installation is an MSI installation. However, there is syntax to make this work.
winget install --id Microsoft.PowerShell --source winget
This hones in on the precise package and the precise source (winget vs Store). Now, we are destined for greatness. After the install is complete, I’ll close Terminal, re-launch it, and then run $PSVersionTable to confirm we’re running the latest version.
Based on how you initially installed PowerShell 7.x, you can also use Windows Update to get the latest supported release. Be advised that it may take longer to get the latest versions of PowerShell using this method.
It is prudent to include instructions on how to install PowerShell 7 in case you don’t have it installed on a particular system. When I started this article, I only had the built-in Windows 5.1 version of PowerShell.
The easiest method, seeing as we’re already in Windows Terminal, is to use winget to install it directly. No need to go anywhere else. (I’ll include the other methods next…)
winget install Microsoft.PowerShell
This will automatically:
Piece of cake. As of this writing, the latest version is the newly released PowerShell 7.5.1.
Let’s confirm installation:
I’ll also show you how to confirm with Windows Terminal in a few sections.
Another method for installing PowerShell 7 is using the Microsoft Store.
The last method to install PowerShell 7 is from the web.
The preferred method to install and update PowerShell on Linux (Ubuntu, in this case) is to use Microsoft’s Package Repository. You can use this script from Microsoft’s Learn website to install the latest version.
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Get the version of Ubuntu
source /etc/os-release
# Download the Microsoft repository keys
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
# Register the Microsoft repository keys
sudo dpkg -i packages-microsoft-prod.deb
# Delete the Microsoft repository keys file
rm packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
###################################
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh
I use Windows Subsystem for Linux (WSL) and have an Ubuntu 24.04.2 LTS distribution. Here is the output from the script.
You can see the 7.5.1-1 version being installed, and then the launch of PowerShell with the prompt. Very easy.
Remember when I mentioned earlier about how to confirm that PowerShell 7 was installed on your system using Windows Terminal? Well, here we are.
Every time Terminal is launched, it scans specific areas of your system (Registry), enumerates detected versions of PowerShell, WSL, etc., and confirms/adds a profile for each iteration.
Now we see the second tab shows ‘PowerShell 7.5.1’ running. Let’s confirm (again) with the $PSVersionTable command.
‘PSVersion’ shows the very precise and concise ‘7.5.1’. Again, a piece of cake.
Let me finish up this article with some troubleshooting you can perform and some best practices for updating and managing your PowerShell environments.
Thank you for reading my latest post on updating PowerShell. If you have any questions or comments, please leave them below in the Comments section. Thank you!
Yes, upgrading PowerShell is generally recommended, especially if you are using Windows PowerShell 5.1 or older. Newer versions of PowerShell (specifically PowerShell 7+, also known as PowerShell Core) offer:
However, check your organization’s software compatibility and scripts before upgrading, as some legacy modules or scripts may need adjustments.
There isn’t an automatic update mechanism built into PowerShell itself, but you can:
winget
on Windows: powershell winget search Microsoft.PowerShell
Run the following command in your PowerShell terminal:
$PSVersionTable.PSVersion
This returns details like the major, minor, build, and revision numbers of the installed PowerShell version.
To use the latest PowerShell in Visual Studio Code:
Ctrl+Shift+X
).Ctrl+Shift+P
and type Select Default Shell
.pwsh.exe
for PowerShell Core).winget
: powershell winget upgrade --id Microsoft.PowerShell
brew update && brew upgrade --cask powershell
sudo apt-get update sudo apt-get install --only-upgrade powershell
Note: Always restart your shell or VS Code after an update to apply the changes.
Ctrl+Shift+X
to open Extensions.How do I make sure it’s working?
Open a .ps1
file — you should see syntax highlighting and IntelliSense. The PowerShell language should appear in the bottom-right corner.
Can I choose which PowerShell version VS Code uses?
Yes! Press Ctrl+Shift+P
, run PowerShell: Show Session Menu
, and pick your preferred version (like PowerShell 7).