- Updating Windows PowerShell 5.1
- Installing and Updating PowerShell [Core] 7
When running scripts in Windows PowerShell, we may encounter some errors because of the outdated PowerShell
version. To check the Windows PowerShell version, we can type in $PSVersionTable
in our scripting environment or run the syntax below.
Get-Host | Select-Object Version
We could get automatic updates from Windows Update in the past. Still, as Microsoft is slowly migrating to PowerShell [Core] 7.0 as its primary scripting version, PowerShell 5.1 is the last version that will be ever released.
This article will show you how to get updates on demand using Windows PowerShell.
Updating Windows PowerShell 5.1
Right now, given that Windows PowerShell 5.1 is in a maintenance-only mode, we will see no new significant development, unlike its recent successor, PowerShell [Core] 7 edition.
However, you can update the PowerShellGet
module, in which the problem-causing Register-PSRepository
command is defined. To update Windows PowerShell 5.1, run the following command below.
Update-Module PowerShellGet
While you usually would just run the command above, a different approach is required the first time when switching to the latest version from the PowerShell Gallery.
- Open an elevated session [Run as Administrator].
- Execute the following [add
-Verbose
to get detailed information]:
Install-Module PowerShellGet -Force
The -Force
enables installation even though a module by that name is already installed. Note that you may still see a prompt about downloading the NuGet
package provider.
Note that the old PowerShellGet
version will linger in a different location, but the new one will take
precedence over it.
After this initial switch to the gallery-installed version, you’ll be able to use Update-Module PowerShellGet
for future versions.
Installing and Updating PowerShell [Core] 7
Unlike Windows PowerShell 5.1, Windows PowerShell [Core] 7 doesn’t pre-load in Windows operating systems and requires manual installation. If you’re running Windows 10 operating systems and above, you can get PowerShell [Core] 7 in the Microsoft Store.
Alternatively, we can use the Windows Package Manager or winget
command line to quickly discover, install, upgrade, remove and configure applications on Windows 10 computers.
The Windows Package Manager or winget
is currently in preview. To install the preview of winget
, you have two choices:
- The command
winget
is open source, which technically means you can clone, build, and run the repository from Github. - You can also become a Windows Insider and join the Windows Package Manager Insider program by sending your Microsoft Account to
and requesting to be included in the preview.
After joining the Insider program, go to the Microsoft Store and get App Installer’s application. The Windows Package Manager or winget
will be available after you get the update.
Now you can start using the
Windows Package Manager or winget
in the Windows Terminal, Windows CLI, or Windows PowerShell. The command-line client winget.exe
is already pre-configured to point to the Microsoft community repository.
To check for all available PowerShell installers in the Windows Package Manager, run the command below.
winget search powershell
You can run the following command below to install the latest Windows PowerShell [Core] 7 version.
winget install powershell
You can also use winget
to upgrade your current Windows
PowerShell version.
winget upgrade powershell
Alternatively, you can use the following script below to get an updated Windows PowerShell package.
Invoke-Expression "& { $[irm //aka.ms/install-powershell.ps1] } -UseMSI"
Run the following command from the command prompt wait until it gets downloaded, and it will prompt to installation wizard to follow the instructions to install it.
- Home
- Windows
PowerShell is a really useful tool if you know your way around it. Here's how to get it, or update it if you already have it.
Windows PowerShell is a command-line tool developed by Microsoft that helps you automate mundane tasks on your system. If you’re an avid Windows user who uses PowerShell on a regular basis, you'll want to use the most recent version of the tool.
There are several ways to install or update PowerShell on Windows 11. In this article, we take a look at all of them.
1. How to Install or Update PowerShell With the Winget Command
The Windows Package Manager [or Winget] is a command-line program that you can use to install apps on Windows. This eliminates the need to search for the app on the web and go through the tedious installation process.
Using the Winget command is one of the most straightforward ways to install or update PowerShell in Windows 11. Here are the steps you can follow.
- Click the magnifying glass on the taskbar or press Win + S to open the search menu.
- Type Command Prompt in the search box at the top.
- Select Run as administrator to open Command Prompt with administrative privileges.
- Select Yes when the User Account Control [UAC] prompt appears.
- Paste the following command in the console and press Enter to view all the available versions of the PowerShell app.
winget search PowerShell
- Note down the ID associated with the PowerShell app you want to get.
- Run the following command to install the PowerShell app.
winget install AppID
Replace AppID in the above command with the actual app ID noted in the last step.
Wait for Winget to download and install PowerShell on your PC and then exit the terminal window. Following that, the PowerShell app should be available for use.
Conveniently, the Winget command also lets you install multiple apps at once. If you want to learn how, check our guide on how to batch-install multiple software packages in Windows 11.
2. How to Install or Update PowerShell From GitHub
Another way to install or update PowerShell on Windows is to download its installer package from the GitHub website. Here's how you can go about it.
- Open up your preferred web browser and navigate to GitHub's PowerShell page.
- Select the latest PowerShell version from the GitHub page.
- Scroll down the Assets section and download the MSI file on your PC.
- Open the installer package and click Next.
- Specify the installation folder and click Next.
- Click Next again.
- Check the boxes that read Enable updating PowerShell through
Microsoft Update or WSUS and Use Microsoft Update when I check for updates. Then, click Next.
- Click the Install button and follow the on-screen instructions to complete the process.
And that’s about it. Once you complete the above steps, you’ll have the latest version of PowerShell at your disposal.
3. How to Install or Update PowerShell Using the Microsoft Store
The PowerShell app is also available on Microsoft Store. To install or update the PowerShell app using Microsoft Store, use the following steps:
- Open the Microsoft Store app on your PC.
- Use the search bar at the top to locate the PowerShell app on the store.
- Click the Update button to update the PowerShell app. If you don't have the app, click the Install button to get it.
If you're having trouble opening the Microsoft Store app on your Windows 11, fix it so that you can update your apps easily.
Automate Your Tasks With PowerShell
Using the most recent version of PowerShell should give you access to the latest features. You can use any of the methods you like to install or update PowerShell on Windows 11.
Now that you’ve got the latest version of PowerShell, why not learn some alternative ways to open it on your Windows PC?