Installing PowerShell Core on Windows
There are multiple ways to install PowerShell Core in Windows.
To enable PowerShell remoting over WSMan, the following prerequisites need to be met:
- Install the Universal C Runtime on Windows versions prior to Windows 10. It is available via direct download or Windows Update. Fully patched (including optional packages), supported systems will already have this 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.
To install PowerShell on a Windows client or Windows Server (works on Windows 7 SP1, Server 2008 R2, and later), download the MSI 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 MSI file looks like this -
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
- You can launch PowerShell via the Start Menu or
Administrative install from the command line
MSI packages can be installed from the command line. This allows administrators to deploy packages without user interaction. The MSI package for PowerShell 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 examples shows how to silently install PowerShell Core with all the install options enabled.
msiexec.exe /package PowerShell-<version>-win-<os-arch>.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1
For a full list of command line options for Msiexec.exe, see Command line options.
PowerShell binary ZIP archives are provided to enable advanced deployment scenarios. Be noted that when using the ZIP archive, you won't get the prerequisites check as in the MSI package. For remoting over WSMan to work properly,, ensure that you have met the prerequisites.
Deploying on Windows IoT
Windows IoT already comes with Windows PowerShell which we will use to deploy PowerShell Core 6.
PSSessionto target device
$s = New-PSSession -ComputerName <deviceIp> -Credential Administrator
Copy the ZIP package to the device
# change the destination to however you had partitioned it with sufficient # space for the zip and the unzipped contents # the path should be local to the device Copy-Item .\PowerShell-<version>-win-<os-arch>.zip -Destination u:\users\administrator\Downloads -ToSession $s
Connect to the device and expand the archive
Enter-PSSession $s Set-Location u:\users\administrator\downloads Expand-Archive .\PowerShell-<version>-win-<os-arch>.zip
Setup remoting to PowerShell Core 6
Set-Location .\PowerShell-<version>-win-<os-arch> # Be sure to use the -PowerShellHome parameter otherwise it'll try to create a new # endpoint with Windows PowerShell 5.1 .\Install-PowerShellRemoting.ps1 -PowerShellHome . # You'll get an error message and will be disconnected from the device because it has to restart WinRM
Connect to PowerShell Core 6 endpoint on device
# Be sure to use the -Configuration parameter. If you omit it, you will connect to Windows PowerShell 5.1 Enter-PSSession -ComputerName <deviceIp> -Credential Administrator -Configuration powershell.<version>
Deploying on Nano Server
These instructions assume that a version of PowerShell is already running on the Nano Server image and that it has been generated by the Nano Server Image Builder. Nano Server is a "headless" OS. Core binaries can be deploy 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 will need the Windows 10 x64 ZIP release package and will need to run the commands within an "Administrator" PowerShell instance.
Offline Deployment of PowerShell Core
- 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 inbox instance of Windows PowerShell.
- Follow the instructions to create a remoting endpoint using the "another instance technique".
Online Deployment of PowerShell Core
The following steps guide you through the deployment of PowerShell Core to a running instance of Nano Server and the configuration of its remote endpoint.
Connect to the inbox instance of Windows PowerShell
$session = New-PSSession -ComputerName <Nano Server IP address> -Credential <An Administrator account on the system>
Copy the file to the Nano Server instance
Copy-Item <local PS Core download location>\powershell-<version>-win-x64.zip c:\ -ToSession $session
Enter the session
Extract the ZIP file
# Insert the appropriate version. Expand-Archive -Path C:\powershell-<version>-win-x64.zip -DestinationPath "C:\PowerShellCore_<version>"
If you want WSMan-based remoting, follow the instructions to create a remoting endpoint using the "another instance technique".
How to create a remoting endpoint
PowerShell Core supports the PowerShell Remoting Protocol (PSRP) over both WSMan and SSH. For more information, see:
Send feedback about: