What’s New in PowerShell 7?
The latest version, PowerShell 7, builds on the previous PowerShell Core 6.1. It continues to support cross-platform deployment and adds a slew of new features, cmdlets, and bug fixes. Some of the more significant new features include:
Pipeline parallelization with ForEach-Object: Iterate through items of a collection in parallel with the new -Parallel parameter or set a maximum thread count (the default is five) with the -ThrottleLimit parameters. The addition of new operators: Ternary operator “? : ” : Works much like an if-else statement by comparing two expressions against a condition to see if it’s true or false, e. g. , Test-Path “C:\Users” ? “exists” : “does not exist” Pipeline chain operators “||” and “&&” : The && operator executes the right-hand pipeline if the left-hand pipeline succeeded. Conversely, the || operator only executes the right-hand pipeline if the left-hand pipeline fails. Get-Error cmdlet: A simplified and dynamic error view for easier investigation of the most recent error in the current session. Automatic new version notifications: Notify users when a new version of PowerShell is available. The default update checks once per day for a new release.
In addition to the new features listed above, Microsoft has added numerous other cmdlets, experimental improvements, and added PowerShell 7 to its Long Term Servicing release, which will enable it to receive updates for as long as .Net 3.1 is supported. A full list of everything new, fixes, and improvements is available from the Github changelog for PowerShell 7.
Ternary operator “? : ” : Works much like an if-else statement by comparing two expressions against a condition to see if it’s true or false, e. g. , Test-Path “C:\Users” ? “exists” : “does not exist” Pipeline chain operators “||” and “&&” : The && operator executes the right-hand pipeline if the left-hand pipeline succeeded. Conversely, the || operator only executes the right-hand pipeline if the left-hand pipeline fails.
RELATED: How PowerShell Differs From the Windows Command Prompt
How to Install PowerShell 7 with an MSI Package
PowerShell 7 is available for Windows, macOS, and Linux. We’ll show you how to install it on Windows 10.
The first method we’re going to cover uses an MSI file to install PowerShell. MSI packages work almost identically to an EXE file and allow you to install a program using a graphical user interface. It’s an installation method that only uses the necessary and core files needed. All you have to do is double-click the package to start the setup wizard.
Note: PowerShell 7 installs and runs side-by-side with Windows PowerShell 5.1—the version that comes with Windows 10—and replaces PowerShell Core 6.x. If you need to run PowerShell 6 side-by-side with PowerShell 7, you will need to install it via the ZIP package.
To download the package, fire up your browser and head on over the PowerShell Github releases page. Scroll down to to the Assets section, and click on the MSI package release to download it.
Be sure to select the right package for your version of Windows, x64 for 64-bit and x86 for 32-bit systems. If you’re unsure which one you have, it’s easy to find out which one your system is running.
RELATED: How Do I Know if I’m Running 32-bit or 64-bit Windows?
If prompted, choose a destination for the download, and click “Save” to start the download.
After the download completes, navigate to the folder where the file is, and double-click it to run the installation.
How to Install PowerShell 7 with a Command
The PowerShell team has also put together a script you can invoke directly from PowerShell. It’s a one-liner cmdlet that downloads and runs the setup wizard automatically. All you have to do is paste the code snippet in and hit the Enter key.
Fire up PowerShell and copy/paste the following cmdlet into the window:
Press the Enter key, and PowerShell will run the command and begin the download.
Going Through the Installer
When the setup wizard opens, click “Next” to install PowerShell 7.
On the next screen, choose a destination folder, and then click “Next” when you’re ready to continue.
Next, you get to decide which optional features to enable on the install. You can enable or disable the following four options:
Add PowerShell to Path Environment Variable: Adds PowerShell to the Windows Path environment variable and allows you to call PowerShell from any other shell or terminal. Register Windows Event Logging Manifest: Adds PowerShell to the Windows Event Logging Manifest and allows you to log events from within a PowerShell instance. Enable PowerShell Remoting: Enables the ability to run commands remotely. Add ‘Open here’ Context Menus to Explorer: Adds an option inside the right-click context menu that opens an instance of PowerShell in the folder you click.
Click “Next” after choosing all the optional features you want.
Click “Install” to begin the installation. A UAC prompt will appear, asking for admin privileges to install the package. Click “Yes” to continue.
Once the setup wizard completes, click “Finish” to exit.
How to Open PowerShell 7
After the installation is complete, you can open PowerShell 7 in a few ways.
If you selected the options “Add PowerShell to Path Environment Variable” and “Add ‘Open here’ Context Menus to Explorer,” you can type “pwsh” into Command Prompt or right-click a folder and click PowerShell 7 > Open here. However, one of the easiest methods is to search using the Start menu.
Press the Windows key or click the Start button, type “pwsh” into the text field, and press Enter or click “Open” when PowerShell 7 appears in the results.
You’ll know you’re using the current and up-to-date version of PowerShell by looking for “PowerShell 7” in the window’s title bar.