The installation commands in this article are for the latest stable release of PowerShell. Toinstall a different version of PowerShell, adjust the command to match the version you need. Thefollowing links direct you to the release page for each version in the PowerShell repository onGitHub.
Winget, the Windows Package Manager, is a command-line tool enables users to discover, install,upgrade, remove, and configure applications on Windows client computers. This tool is the clientinterface to the Windows Package Manager service. The winget command-line tool is bundled withWindows 11 and modern versions of Windows 10 by default as the App Installer.
Windows Server 2025 Preview Build 26085 and later includes winget for Windows Server withDesktop Experience only. For more information, seeAnnouncing Windows Server Preview Build 26085.
On Windows systems using X86 or X64 processor, winget installs the MSI package. On systems usingthe Arm64 processor, winget installs the Microsoft Store (MSIX) package. For more information,see Installing from the Microsoft Store.
PowerShell 7.4 installs to a new directory and runs side-by-side with Windows PowerShell 5.1.PowerShell 7.4 is an in-place upgrade that removes previous versions of PowerShell 7. Previewversions of PowerShell can be installed side-by-side with other versions of PowerShell.
PowerShell 7.2 and newer has support for Microsoft Update. When you enable this feature, you'll getthe latest PowerShell 7 updates in your traditional Microsoft Update (MU) management flow, whetherthat's with Windows Update for Business, WSUS, Microsoft Endpoint Configuration Manager, or theinteractive MU dialog in Settings.
Enabling updates may have been set in a previous installation or manual configuration. UsingENABLE_MU=0 doesn't remove the existing settings. Also, this setting can be overruled by GroupPolicy settings controlled by your administrator.
MSI packages can be installed from the command line allowing administrators to deploy packageswithout user interaction. The MSI package includes the following properties to control theinstallation options:
Depending on how you download the file you may need to unblock the file using the Unblock-Filecmdlet. Unzip the contents to the location of your choice and run pwsh.exe from there. Unlikeinstalling the MSI packages, installing the ZIP archive doesn't check for prerequisites. Forremoting over WSMan to work properly, ensure that you've met the prerequisites.
The dotnet tool installer adds $HOME\.dotnet\tools to your $env:PATH environment variable.However, the currently running shell doesn't have the updated $env:PATH. You can start PowerShellfrom a new shell by typing pwsh.
By default, Windows Store packages run in an application sandbox that virtualizes access to somefilesystem and registry locations. Changes to virtualized file and registry locations don't persistoutside of the application sandbox.
This sandbox blocks all changes to the application's root folder. Any system-level configurationsettings stored in $PSHOME can't be modified. This includes the WSMAN configuration. This preventsremote sessions from connecting to Store-based installs of PowerShell. User-level configurations andSSH remoting are supported.
Beginning in PowerShell 7.2, the PowerShell package is now exempt from file and registryvirtualization. Changes to virtualized file and registry locations now persist outside of theapplication sandbox. However, changes to the application's root folder are still blocked.
For best results when upgrading, you should use the same install method you used when you firstinstalled PowerShell. If you aren't sure how PowerShell was installed, you can check the value ofthe $PSHOME variable, which always points to the directory containing PowerShell that the currentsession is running.
When upgrading, PowerShell won't upgrade from an LTS version to a non-LTS version. It onlyupgrades to the latest version of LTS, for example, from 7.2.3 to 7.2.21. To upgrade from anLTS release to a newer stable version or the next LTS, you need to install the new version withthe MSI for that release.
Windows 10 IoT Core adds Windows PowerShell when you include IOT_POWERSHELL feature, which we canuse to deploy PowerShell 7. The steps defined above for Windows 10 IoT Enterprise can be followedfor IoT Core as well.
Microsoft supports the installation methods in this document. There may be other third-party methodsof installation available from other sources. While those tools and methods may work, Microsoftcan't support those methods.
The best place to start is over on the Github.com page for PowerShell. Not only do they have installers for every supported operating system, they have a good getting started guide for anyone new to PowerShell.
The original PowerShell used a v1.0 folder but never changed it for future versions. The install location moved out of the C:\Windows\System32 folder and into c:\Program Files. All the names that were WindowsPowerShell are now PowerShell. You will see this in other places too.
The second one C:\Program Files\PowerShell\Modules is for all users of the system. If you are installing a module for everyone to use, it should be in this location. DSC will look here for modules when it is configuring a system. Again, we have a slight name change.
The third one c:\program files\powershell\6.0.0\Modules is for modules that are core to PowerShell itself. Generally this is a folder that you would not manage. If you need to add or update a module on your system, you will place it in one of the previous folders.
This is mostly due to the renaming of folder. If you do have important stuff in your profile, you will need to add it to your new profile location. Most people use the profile to set a custom prompt or import often used modules.
If you installed Power Shell 7 from an MSI, then a PowerShell 7 folder, exists in your Program Files directory. If you installed it from the Microsoft Store, it will exist within a directory, contained in the WindowsApps directory.
According to a list of tasks the VS Code team worked on last year, the current version of Visual Studio Code, automatically detects PowerShell 7 from the Microsoft Store., If it's not being automatically detected you should simply update Visual Studio Code to the current version.
Why did I choose this path instead of the path that the other answers pointed out? If you choose this path, you can ignore the PowerShell version stuff, meaning that you can upgrade the Powershell version without changing the Powershell path again.
Looking that up, I found that my 'Environment Variables' were not correct. Specifically, Powershell was not in my path variable. (btw, Why not? There's all types of weird stuff there, why is PS not there?)
Windows PowerShell is the traditional version that ships as part of Windows operating systems - i.e. you don't need to install it. This version lives under C:\Windows\System32\WindowsPowerShell\v1.0\ and the shell's name is powershell.exe. This version is Windows-only.
There's not enough information to know your starting position, and the error from the first command doesn't make sense to me, as pwsh.dll doesn't live in %windir%\System32 by default - at least not under PowerShell v7 and above (and it doesn't relate at all to Windows PowerShell).
As an aside, "powershell --version" is an invalid command when referencing Windows PowerShell, and it's not the same at all as "pwsh --version". But that's unimportant in the context of the error you received.
Purely as a point of reference, I only have two path inclusions (in the system "path" variable) on my machine, where the first is from the per machine installation of PowerShell, and the second is from the out-of-box Windows PowerShell:
Given this thread started in the context of Windows Home, which I'm unfamiliar with, I have to point out that the above screenshot pertains to Windows 10 Enterprise (64-bit), meaning user of Home may or may not see the same output.
I found two issues. Pwsh did not exist in the target directory but did exist earlier in the path. I copied the pwsh.exe to the target directory and the installation proceeded further before reaching the could not copy issue. On investigation the relevant directory already contained the file that the .tmp file was trying to be renames to. It seems I have an earlier installtion of ocaml but have no recollection of trying to do so. I deleted the relevant ocaml directories and .\setup-diskuv-ocaml-windows_x86_64-1.2.0.exe ran to completion without errors.
The PowerShell team just announced PowerShell 7. PowerShell 7 is built on .NET Core 3 and brings back many APIs required by modules built on .NET Framework so that they work with .NET Core runtime. While PowerShell Core 6 was focusing on bringing cross-platform compatibility, PowerShell 7 will focus on making it a viable replacement for Windows PowerShell 5.1 and bringing near parity with Windows PowerShell. Here is how you can install and update PowerShell 7 on Windows and Linux using a simple one-liner.
If you are running Windows 10, and you have a new command-line tool called winget. The winget command line tool enables you to easily discover, install, upgrade, remove and configure applications on Windows 10 computers.
You might ask, what my preferred way is? On Windows 10 I am definitely using the Microsoft Store and with winget I can easily do that from the command line. I hope this blog post was helpful. If you have any questions, please let me know in the comments.
Successfully installed PowerShell 7.0.2.
Now attempting to configure Windows Terminal to open a powershell 7.0.2 tab. In the settings.json file, it seems I need the GUID for this software. Where do I find it?
Hi Thomas, I guess something must have changed because when I use the one-liner with -UseMSI parameter, the installer gets stuck prompting to close the very PWSH session that I am running this one-liner from. Am I doing something wrong here?
4a15465005