How to Upgrade to PowerShell 7
In the first half of 2019, Microsoft introduced the next version of PowerShell known as PowerShell 7. PowerShell 7 is the latest version of the popular scripting/automation/development language stemming from the previous version of PowerShell Core 6.2.
PowerShell 7 brings about many changes like now using .NET Core 3.0, trimming the gap between Windows PowerShell and PowerShell Core functionality, simplifying credential management and more. All of these updates are great but how do you leverage them if you’re still using Windows PowerShell or PowerShell Core 6.x? Let’s find out! Although PowerShell 7 is supported on nearly all platforms, we’ll be sticking with Windows in this article.
Upgrading from Windows PowerShell
Upgrading isn’t a fair term when referring to Windows PowerShell 5.1 and PowerShell 7. PowerShell 7 can exist completely separate from Windows PowerShell on the same Windows system. This is a big benefit allowing you to slowly wean yourself off of Windows PowerShell rather than all at once.
There are a few ways you can install PowerShell 7. You can use the MSI via the PowerShell GitHub releases page or by using Windows PowerShell.
Installing PowerShell 7 via an MSI
Installing PowerShell 7 via an MSI first requires downloading the MSI from GitHub. You can do that by finding the latest version here and walking through the wizard. Since it’s an MSI, you’ll see the familiar wizard. Stepping through the default options is sufficient to get PowerShell 7 installed.
Installing with Windows PowerShell
If you’d rather use PowerShell to install PowerShell you can use the
Invoke-RestMethod
cmdlet. Using this cmdlet, you can download and execute an installer script provided by the PowerShell team. Below you will see a code snippet on how to do this in Windows PowerShell.
In the below snippet, Windows PowerShell is downloading the install-powershell.ps1 script and executing it. It’s executing the script with
Invoke-Expression
passing the UseMSI
and Preview
parameters. At the time of writing, the Preview
parameter is required since PowerShell 7 is in preview but this might not be the case at a later time.For more information with an in-depth walkthrough on each method, check out the article, Upgrading to PowerShell 7: A Walkthrough.
Upgrading from PowerShell Core
Not only can you install PowerShell 7 side-by-side with Window PowerShell, but you can also do the same with previous versions of PowerShell Core as well. Using one of the methods above to execute the PowerShell 7 MSI on the computer, PowerShell 7 will install with PowerShell Core.
When the PowerShell 7 installer completes, you’ll find two folders in C:\Program Files\PowerShell called 6 and 7-preview (for the preview version). Each folder stores a completely different version.
Although unconfirmed at this time, it is believed that when PowerShell 7 comes out of Preview, the GA version will create a folder called 7. This will then be where all minor version upgrades to PowerShell 7 will be applied overwriting the last version.
Summary
Upgrading to PowerShell 7 on Windows is easy using the MSI installer. The most important thing to know is that unlike Windows PowerShel, PowerShell 7 is a standalone package. Don’t immediately assume that you have the latest version of PowerShell on a new Windows 10 machine. You will always have to manually install the MSI package to get the latest and greatest features.
How to Upgrade to PowerShell 7
Reviewed by Tya Chyntya
on
October 05, 2019
Rating:
No comments: