Installing PowerShell on Windows
There are multiple ways to install PowerShell in Windows.
Prerequisites
The latest release of PowerShell is supported on Windows 7 SP1, Server 2008 R2, and later versions.
To enable PowerShell remoting over WSMan, the following prerequisites need to be met:
- Install the Universal C Runtime on Windows versions predating Windows 10. It’s available via direct download or Windows Update. Fully patched systems already have this package installed.
- Install the Windows Management Framework (WMF) 4.0 or newer on Windows 7 and Windows Server 2008 R2. For more information about WMF, see WMF Overview.
Download the installer package
To install PowerShell on Windows, download the install package from our GitHub releases page. Scroll down to the Assets section of the Release page. The Assets section may be collapsed, so you may need to click to expand it.
Installing the MSI package
The MSI file looks like PowerShell- -win- .msi . For example:
Once downloaded, double-click the installer and follow the prompts.
The installer creates a shortcut in the Windows Start Menu.
- By default the package is installed to $env:ProgramFiles\PowerShell\
- You can launch PowerShell via the Start Menu or $env:ProgramFiles\PowerShell\ \pwsh.exe
PowerShell 7 installs to a new directory and runs side-by-side with Windows PowerShell 5.1. For PowerShell Core 6.x, PowerShell 7 is an in-place upgrade that removes PowerShell Core 6.x.
- PowerShell 7 is installed to $env:ProgramFiles\PowerShell\7
- The $env:ProgramFiles\PowerShell\7 folder is added to $env:PATH
- The $env:ProgramFiles\PowerShell\6 folder is deleted
If you need to run PowerShell 6 side-by-side with PowerShell 7, reinstall PowerShell 6 using the ZIP install method.
Administrative install from the command line
MSI packages can be installed from the command line allowing administrators to deploy packages without user interaction. The MSI package includes the following properties to control the installation options:
- ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL — This property controls the option for adding the Open PowerShell item to the context menu in Windows Explorer.
- ENABLE_PSREMOTING — This property controls the option for enabling PowerShell remoting during installation.
- REGISTER_MANIFEST — This property controls the option for registering the Windows Event Logging manifest.
The following example shows how to silently install PowerShell with all the install options enabled.
For a full list of command-line options for Msiexec.exe , see Command line options.
Registry keys created during installation
Beginning in PowerShell 7.1, the MSI package creates registry keys that store the installation location and version of PowerShell. These values are located in HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\ . The value of is unique for each build type (release or preview), major version, and architecture.
Release | Architecture | Registry Key |
---|---|---|
7.1.x Release | x86 | HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\1d00683b-0f84-4db8-a64f-2f98ad42fe06 |
7.1.x Release | x64 | HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\31ab5147-9a97-4452-8443-d9709f0516e1 |
7.1.x Preview | x86 | HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\86abcfbd-1ccc-4a88-b8b2-0facfde29094 |
7.1.x Preview | x64 | HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\39243d76-adaf-42b1-94fb-16ecf83237c8 |
This can be used by administrators and developers to find the path to PowerShell. The values will be the same for all preview and minor version releases. The values are changed for each major release.
Installing the MSIX package
The MSIX package is not officially supported at this time. We continue to build the package for internal testing purposes only.
To manually install the MSIX package on a Windows 10 client, download the MSIX package from our GitHub releases page. Scroll down to the Assets section of the Release you want to install. The Assets section may be collapsed, so you may need to click to expand it.
The MSIX file looks like this — PowerShell- -win- .msix
To install the package, you must use the Add-AppxPackage cmdlet.
Installing the ZIP package
PowerShell binary ZIP archives are provided to enable advanced deployment scenarios. Installing the ZIP archive doesn’t check the prerequisites like the MSI packages do. Download the ZIP archive from the releases page. Depending on how you download the file you may need to unblock the file using the Unblock-File cmdlet. Unzip the contents to the location of your choice and run pwsh.exe from there. For remoting over WSMan to work properly, ensure that you’ve met the prerequisites.
Deploying on Windows 10 IoT Enterprise
Windows 10 IoT Enterprise comes with Windows PowerShell, which we can use to deploy PowerShell 7.
Create PSSession to target device
Copy the ZIP package to the device
Connect to the device and expand the archive
Set up remoting to PowerShell 7
Connect to PowerShell 7 endpoint on device
Deploying on Windows 10 IoT Core
Windows 10 IoT Core adds Windows PowerShell when you include IOT_POWERSHELL feature, which we can use to deploy PowerShell 7. The steps defined above for Windows 10 IoT Enterprise can be followed for IoT Core as well.
For adding the latest powershell in the shipping image, use Import-PSCoreRelease command to include the package in the workarea and add OPENSRC_POWERSHELL feature to your image.
For ARM64 architecture, Windows Powershell is not added when you include IOT_POWERSHELL. So the zip based install will not work. You will need to use Import-PSCoreRelease command to add it in the image.
Deploying on Nano Server
These instructions assume that the Nano Server is a «headless» OS that has a version of PowerShell is already running on it. For more information, see the Nano Server Image Builder documentation.
PowerShell binaries can be deployed using two different methods.
- Offline — Mount the Nano Server VHD and unzip the contents of the zip file to your chosen location within the mounted image.
- Online — Transfer the zip file over a PowerShell Session and unzip it in your chosen location.
In both cases, you need the Windows 10 x64 ZIP release package. Run the commands within an «Administrator» instance of PowerShell.
Offline Deployment of PowerShell
- Use your favorite zip utility to unzip the package to a directory within the mounted Nano Server image.
- Unmount the image and boot it.
- Connect to the built-in instance of Windows PowerShell.
- Follow the instructions to create a remoting endpoint using the «another instance technique».
Online Deployment of PowerShell
Deploy PowerShell to Nano Server using the following steps.
Connect to the built-in instance of Windows PowerShell
Copy the file to the Nano Server instance
Extract the ZIP file
If you want WSMan-based remoting, follow the instructions to create a remoting endpoint using the «another instance technique».
Install as a .NET Global tool
If you already have the .NET Core SDK installed, it’s easy to install PowerShell as a .NET Global tool.
The dotnet tool installer adds $env:USERPROFILE\dotnet\tools to your $env:PATH environment variable. However, the currently running shell doesn’t have the updated $env:PATH . You can start PowerShell from a new shell by typing pwsh .
Install PowerShell via Winget
The winget command-line tool enables developers to discover, install, upgrade, remove and configure applications on Windows 10 computers. This tool is the client interface to the Windows Package Manager service.
The winget tool is currently a preview. Not all planned functionality is available at this time. The tool’s options and features are subject to change. You should not use this method in a production deployment scenario. See the winget documentation for a list of system requirements and install instructions.
The following commands can be used to install PowerShell using the published winget packages:
Search for the latest version of PowerShell
Install a version of PowerShell using the —exact parameter
How to create a remoting endpoint
PowerShell supports the PowerShell Remoting Protocol (PSRP) over both WSMan and SSH. For more information, see:
Installation support
Microsoft supports the installation methods in this document. There may be other methods of installation available from other sources. While those tools and methods may work, Microsoft cannot support those methods.
Установка Windows PowerShell Installing Windows PowerShell
Windows PowerShell установлен по умолчанию в каждой ОС Windows, начиная с Windows 7 с пакетом обновления 1 (SP1) и Windows Server 2008 R2 с пакетом обновления 1 (SP1). Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1 and Windows Server 2008 R2 SP1.
Если вас интересует PowerShell версии 6 или более поздней, вам нужно установить PowerShell Core вместо Windows PowerShell. If you are interested in PowerShell 6 and later, you need to install PowerShell Core instead of Windows PowerShell. Дополнительные сведения см. в статье Установка PowerShell Core в Windows. For that, see Installing PowerShell Core on Windows.
Поиск PowerShell в Windows 10, 8.1, 8.0 и 7 Finding PowerShell in Windows 10, 8.1, 8.0, and 7
Иногда найти консоль или ISE (интегрированную среду сценариев) PowerShell в Windows бывает непросто, так как их расположение в разных версиях Windows отличается. Sometimes locating PowerShell console or ISE (Integrated Scripting Environment) in Windows can be difficult, as its location moves from one version of Windows to the next.
Следующие таблицы помогут найти PowerShell в вашей версии Windows. The following tables should help you find PowerShell in your Windows version. Все указанные версии являются оригинальными, сразу после выпуска и без обновлений. All versions listed here are the original version, as released, with no updates.
Консоль For Console
Версия Version | Location Location |
---|---|
Windows 10 Windows 10 | Щелкните значок Windows в левом нижнем углу и начните вводить PowerShell. Click left lower corner Windows icon, start typing PowerShell |
Windows 8.1, 8.0 Windows 8.1, 8.0 | На начальном экране начните вводить PowerShell. On the start screen, start typing PowerShell. Если вы находитесь на рабочем столе, щелкните значок Windows в левом нижнем углу и начните вводить PowerShell. If on desktop, click left lower corner Windows icon, start typing PowerShell |
Windows 7 с пакетом обновления 1 (SP1) Windows 7 SP1 | Щелкните значок Windows в левом нижнем углу и в поле поиска начните вводить PowerShell. Click left lower corner Windows icon, on the search box start typing PowerShell |
ISE For ISE
Версия Version | Location Location |
---|---|
Windows 10 Windows 10 | Щелкните значок Windows в левом нижнем углу и начните вводить ISE. Click left lower corner Windows icon, start typing ISE |
Windows 8.1, 8.0 Windows 8.1, 8.0 | На начальном экране введите PowerShell ISE. On the start screen, type PowerShell ISE. Если вы находитесь на рабочем столе, щелкните значок Windows в левом нижнем углу и введите PowerShell ISE. If on desktop, click left lower corner Windows icon, type PowerShell ISE |
Windows 7 с пакетом обновления 1 (SP1) Windows 7 SP1 | Щелкните значок Windows в левом нижнем углу и в поле поиска начните вводить PowerShell. Click left lower corner Windows icon, on the search box start typing PowerShell |
Поиск PowerShell в версиях Windows Server Finding PowerShell in Windows Server versions
Начиная с Windows Server 2008 R2, операционную систему Windows можно установить без графического пользовательского интерфейса (GUI). Starting with Windows Server 2008 R2, Windows operating system can be installed without the graphical user interface (GUI). Выпуски Windows Server без GUI называются выпусками Core, а выпуски с GUI — Desktop. Editions of Windows Server without GUI are named Core editions, and editions with the GUI are named Desktop.
Выпуски Windows Server Core Windows Server Core editions
Во всех выпусках Core при входе на сервер открывается окно командной строки Windows. In all Core editions, when you log to the server you get a Windows command prompt window.
Введите powershell и нажмите клавишу ВВОД, чтобы запустить PowerShell в сеансе командной строки. Type powershell and press ENTER to start PowerShell inside the command prompt session. Введите exit , чтобы завершить сеанс PowerShell и вернуться к командной строке. Type exit to terminate the PowerShell session and return to command prompt.
Выпуски Windows Server Desktop Windows Server Desktop editions
Во всех выпусках Desktop нужно щелкнуть значок Windows в левом нижнем углу и начать вводить PowerShell. In all desktop editions, click the left lower corner Windows icon, start typing PowerShell. Появятся параметры консоли и ISE. You get both console and ISE options.
Единственное исключение из этого правила — ISE в Windows Server 2008 R2 с пакетом обновления 1 (SP1). В этом случае щелкните значок Windows в левом нижнем углу и введите PowerShell ISE. The only exception to the above rule is the ISE in Windows Server 2008 R2 SP1; in this case, click the left lower corner Windows icon, type PowerShell ISE.
Проверка версии PowerShell How to check the version of PowerShell
Чтобы узнать, какая версия PowerShell установлена, запустите консоль PowerShell (или ISE), введите $PSVersionTable и нажмите клавишу ВВОД. To find which version of PowerShell you have installed, start a PowerShell console (or the ISE) and type $PSVersionTable and press ENTER. Найдите значение PSVersion . Look for the PSVersion value.
Обновление существующей версии Windows PowerShell Upgrading existing Windows PowerShell
В пакет установки для PowerShell входит установщик WMF. The installation package for PowerShell comes inside a WMF installer. Версия установщика WMF совпадает с версией PowerShell. Для Windows PowerShell нет отдельного установщика. The version of the WMF installer matches the version of PowerShell; there’s no stand alone installer for Windows PowerShell.
Если вам нужно обновить существующую версию PowerShell, в Windows используйте следующую таблицу, чтобы найти установщик для нужной версии PowerShell. If you need to update your existing version of PowerShell, in Windows, use the following table to locate the installer for the version of PowerShell you want to update to.
Windows Windows | PS 3.0 PS 3.0 | PS 4.0 PS 4.0 | PS 5.0 PS 5.0 | PS 5.1 PS 5.1 |
---|---|---|---|---|
Windows 10 (см. примечание 1) Windows 10 (see Note1) Windows Server 2016 Windows Server 2016 | — | — | — | установлено installed |
Windows 8.1 Windows 8.1 Windows Server 2012 R2 Windows Server 2012 R2 | — | установлено installed | WMF 5.0 WMF 5.0 | WMF 5.1 WMF 5.1 |
Windows 8 Windows 8 Windows Server 2012 Windows Server 2012 | установлено installed | WMF 4.0 WMF 4.0 | WMF 5.0 WMF 5.0 | WMF 5.1 WMF 5.1 |
Windows 7 с пакетом обновления 1 (SP1) Windows 7 SP1 Windows Server 2008 R2 с пакетом обновления 1 (SP1) Windows Server 2008 R2 SP1 | WMF 3.0 WMF 3.0 | WMF 4.0 WMF 4.0 | WMF 5.0 WMF 5.0 | WMF 5.1 WMF 5.1 |
Если в начальном выпуске Windows 10 включены автоматические обновления, PowerShell обновляется с версии 5.0 до 5.1. On the initial release of Windows 10, with automatic updates enabled, PowerShell gets updated from version 5.0 to 5.1. Если оригинальная версия Windows 10 не обновлена в Центре обновления Windows, версия PowerShell будет 5.0. If the original version of Windows 10 is not updated through Windows Updates, the version of PowerShell is 5.0.
Необходимость Azure PowerShell Need Azure PowerShell
Если вы ищете Azure PowerShell, можно начать с раздела Общие сведения об Azure PowerShell. If you’re looking for Azure PowerShell, you could start with Overview of Azure PowerShell.