How to Update PowerShell to Version 7

Upgrading PowerShell to v7

This post contains a guide on how to update PowerShell to version 7, upgrading from PowerShell v5 to the latest version available.

Staying on top of software updates is a universal best practice, and PowerShell is no exception. Ensuring you are running the latest PowerShell version is vital, especially if you want to leverage the newest features and cmdlets. Imagine running a script only to find out that it contains a command unrecognized on your current PowerShell version.

Upgrading PowerShell from v5 to v7

This step-by-step guide covers checking your current PowerShell version, upgrading to PowerShell v7, and adjusting your default PowerShell version in Windows Terminal.

1. Check PowerShell Version

Determining your current PowerShell version is done by simply running $PSVersionTable in your PowerShell console:

# Check PowerShell Version
$PSVersionTable
PowerShell PSVersionTable

The resulting output, as illustrated in the screenshot above, provides details about your current PowerShell version. This example shows a running version of Windows PowerShell v5.

2. Upgrade to PowerShell v7

To perform the upgrade we are using Windows Package Manager (winget), which is a Windows command-line package manager that makes managing installations and upgrades a lot easier. This is the recommended method by Microsoft, as stated in the PowerShell Upgrade docs.

# Search for the Microsoft.PowerShell Package using winget
winget search Microsoft.PowerShell

# Install latest PowerShell Version
winget install --id Microsoft.Powershell --source winget
Installing PowerShell Version 7

The installation process is straightforward and will seamlessly install PowerShell version 7 with the latest release. You should now close and re-open your Windows Terminal.

3. Change Default PowerShell Terminal

With PowerShell Version 7 now installed on our computer, we should now change our default settings in Windows Terminal.

To do this, click the down arrow and select Settings:

Windows Terminal Settings

In the Windows Terminal Startup Settings menu, change the Default profile to PowerShell (the black icon):

Windows Terminal Open PowerShell v7

By making this change we are ensuring every time we open Windows Terminal it will now use PowerShell v7 rather than v5.

Windows Terminal PowerShell Version 7

Conclusion

Maintaining an up-to-date PowerShell version is crucial for optimal performance and compatibility with the latest features and scripts. To ensure you are on the latest release, visit the Microsoft PowerShell GitHub Releases page and compare your current version. If you find that your version is outdated, upgrading to the latest release is recommended.


One response to “How to Update PowerShell to Version 7”

  1. […] your terminal experience by setting the default Windows Terminal profile. Whether it’s PowerShell, Command Prompt, or Ubuntu, customize your environment to align with […]

Leave a Reply

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

Popular Posts

Blog Categories