Command Line to Update PowerShell 7 in Windows 11/10

Published by Nyau Wai Hoe - Updated on

PowerShell 7 is a super useful tool for both developers and IT pros to make their work easier by automating stuff and keeping things in line. If you like keeping your tools fresh to get all the new features, security fixes, and speed boosts, this guide is for you. We’re going to walk you through how to get or update PowerShell 7 using the command line.

What is PowerShell 7? It’s the new version that comes after PowerShell Core 6.x and the old Windows PowerShell 5.1. It’s a big deal because it improves a lot of things, making it a key update for folks who code or manage systems.

Update PowerShell 7 in Windows 11 with command line

Installing PowerShell 7 with “winget”

You can get PowerShell 7 onto your computer using the command line in a few ways. A really handy way is with the Windows Package Manager (winget), which is like a treasure chest for finding, getting, updating, and setting up apps on your Windows 10 or later PC.

  1. Start by opening a command prompt or PowerShell window as an admin.
  2. Put in this command and hit Enter:
    winget install PowerShell

    Install or Update PowerShell 7 in Windows 11

  3. It’ll ask if you’re okay with the terms. Press Y to keep going.update powershell 7
  4. Then winget takes over, grabbing and setting up the latest PowerShell 7 for you.

Note: If your computer doesn’t recognize the winget command, you might need to install the Windows Package Manager. It’s usually already there on Windows 10 version 1809 and newer, including Windows 11. If you don’t have it, you can get it from the Microsoft Store or its GitHub page (https://github.com/microsoft/winget-cli). Or, you can try the next method below.

Related resource: Install Active Directory Users and Computers via PowerShell

Getting or refreshing PowerShell 7 with a script

If winget isn’t doing it for you or you just prefer another way, Microsoft has this handy script you can run to install or update PowerShell 7. This is especially good for making sure everything’s the same across many computers. Just run this command in a PowerShell window:

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

Command line to update PowerShell 7 in Windows 11

Breaking down what this script does

The command looks a bit tricky, but here’s what’s happening:

  • iex: This runs commands or expressions as a string. Here, it’s running the install script.
  • irm: This sends a web request and gets back a response. It’s grabbing the install script from the web.
  • & { ... }: This runs a bunch of statements or expressions all together. The & makes it go.
  • -UseMSI: This tells the script to use the MSI installer, which is a common way to install apps on Windows, letting you pick install options like where to put it.

When you run this, here’s what it does:

  1. Grabs the install script from the web.
  2. Runs the script to check for the newest PowerShell version.
  3. If there’s a newer version, it gets the MSI installer going.
  4. The installer does its thing, updating PowerShell while keeping your setup the same.

This method is awesome for when you need to automate updates or make sure lots of computers are all on the same page.

Getting PowerShell 7 from the Microsoft Store

Another easy way to install or keep PowerShell 7 updated is through the Microsoft Store. When you get it from there, it updates on its own, just like other apps from the Store.

Here’s how to do it:

  1. Hit up the Start menu and open the Microsoft Store.
  2. Search for “PowerShell”.
  3. Find “PowerShell” in the search results and click on it.
  4. Hit the “Get” or “Install” button and follow the steps.Microsoft Store Install Windows PowerShell 7

Choosing the Store means you don’t have to worry about manual updates, making life a bit easier.

Checking if it worked

After installing or updating, it’s smart to make sure everything’s right. Here’s how to check:

  1. Open a new PowerShell window.
  2. Type $PSVersionTable.PSVersion and hit Enter.
  3. You should see the version number of the new PowerShell 7.Check PowerShell 7 version

Some stuff that might go wrong

You might hit a snag updating PowerShell 7 this way. Here are some quick fixes:

  • If winget doesn’t work, check you have the latest Windows Package Manager.
  • If the script method errors out, make sure your PowerShell can run scripts with the Set-ExecutionPolicy cmdlet.
  • For the Store, make sure you’re signed in and your Store app is current.

Wrapping it up

Most of the time, using the command line iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" to get or refresh PowerShell 7 is a smart move. It’s preferred because you get more say in how things go down, making it perfect for people who handle lots of computers or need their setups just right. The script makes sure you’re getting the freshest version straight from Microsoft, plus you get to use MSI tricks for special install needs. It’s easy once you get the hang of it and fits right into scripts for doing lots of updates or setups all at once.

Make sure to check your setup after you update and look at the official PowerShell docs if you need help figuring something out.


Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of WindowsDigitals.com. With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link