From 254afcba04f964b0d6ef4a369b1558a34d3a61d8 Mon Sep 17 00:00:00 2001 From: Mike Richmond Date: Fri, 24 Feb 2017 15:38:29 -0800 Subject: [PATCH] Add instructions for installation on Nano Server (Fixes #3151) (#3195) --- docs/installation/windows.md | 52 ++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/installation/windows.md b/docs/installation/windows.md index 17dc97525..6a9f469b4 100644 --- a/docs/installation/windows.md +++ b/docs/installation/windows.md @@ -16,6 +16,46 @@ There is a shortcut placed in the Start Menu upon installation. > Note: On Windows 8.1 / Windows 2012R2, ensure Visual C++ Redistributable > for VS2015 is installed from [here](http://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe): +# Deploying on Nano Server + +These instructions assume that Windows PowerShell is running on the Nano Server image and that it has been generated by the [Nano Server Image Builder](https://technet.microsoft.com/en-us/windows-server-docs/get-started/deploy-nano-server). +Nano Server is a "headless" OS and deployment of PowerShell Core binaries can happen in two different ways: + +1. Offline - Mount the Nano Server VHD and unzip the contents of the zip file to your chosen location within the mounted image. +2. 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 + +1. Use your favorite zip utility to unzip the package to a directory within the mounted Nano Server image. +2. Unmount the image and boot it. +3. Connect to the inbox instance of Windows PowerShell. +4. Follow the instructions to create a remoting endpoint using the [another instance technique](#executed-by-another-instance-of-powershell-on-behalf-of-the-instance-that-it-will-register). + +## Online Deployment of PowerShell Core + +The following steps will 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 +```powershell +$session = New-PSSession -ComputerName -Credential +``` +* Copy the file to the Nano Server instance +```powershell +Copy-Item \powershell--win10-win2016-x64.zip c:\ -ToSession $session +``` +* Enter the session +```powershell +Enter-PSSession $session +``` +* Extract the Zip file +```powershell +# Insert the appropriate version. +Expand-Archive -Path C:\powershell--win10-win2016-x64.zip -DestinationPath "C:\PowerShellCore_" +``` +* Follow the instructions to create a remoting endpoint using the [another instance technique](#executed-by-another-instance-of-powershell-on-behalf-of-the-instance-that-it-will-register). + # Instructions to Create a Remoting Endpoint Beginning with 6.0.0-alpha.9, the PowerShell package for Windows includes a WinRM plug-in (pwrshplugin.dll) and an installation script (Install-PowerShellRemoting.ps1). @@ -23,10 +63,10 @@ These files enable PowerShell to accept incoming PowerShell remote connections w ## Motivation -An installation of PowerShell can establish PowerShell sessions to remote computers using ```New-PSSession``` and ```Enter-PSSession```. +An installation of PowerShell can establish PowerShell sessions to remote computers using `New-PSSession` and `Enter-PSSession`. To enable it to accept incoming PowerShell remote connections, the user must create a WinRM remoting endpoint. This is an explicit opt-in scenario where the user runs Install-PowerShellRemoting.ps1 to create the WinRM endpoint. -The installation script is a short-term solution until we add additional functionality to ```Enable-PSRemoting``` to perform the same action. +The installation script is a short-term solution until we add additional functionality to `Enable-PSRemoting` to perform the same action. For more details, please see issue [#1193](https://github.com/PowerShell/PowerShell/issues/1193). ## Script Actions @@ -39,13 +79,14 @@ The script 4. Registers that plug-in with WinRM ## Registration + The script must be executed within an Administrator-level PowerShell session and runs in two modes. -* Executed by the instance of PowerShell that it will register +### Executed by the instance of PowerShell that it will register ``` powershell Install-PowerShellRemoting.ps1 -``` -* Executed by another instance of PowerShell on behalf of the instance that it will register. +``` +### Executed by another instance of PowerShell on behalf of the instance that it will register ``` powershell \Install-PowerShellRemoting.ps1 -PowerShellHome "" -PowerShellVersion "" ``` @@ -53,6 +94,7 @@ For Example: ``` powershell C:\Program Files\PowerShell\6.0.0.9\Install-PowerShellRemoting.ps1 -PowerShellHome "C:\Program Files\PowerShell\6.0.0.9\" -PowerShellVersion "6.0.0-alpha.9" ``` +**NOTE:** The remoting registration script will restart WinRM, so all existing PSRP sessions will terminate immediately after the script is run. If run during a remote session, this will terminate the connection. ## How to Connect to the New Endpoint