共用方式為


Deploy and Manage a Nano Server

Nano Server is a remotely administered server operating system optimized for hosting in private clouds and datacenters. It is similar to Windows Server in Server Core mode, but markedly smaller. Also, there is no local logon capability, nor does it support Terminal Services. It takes up far less disk space, sets up significantly faster, and requires far fewer restarts than Windows Server. It's ideal fro the following scenarios:

  • As a “compute” host for Hyper-V virtual machines, either in clusters or not
  • As a storage host for Scale-Out File Server, either in clusters or not
  • As a container or virtual machine guest operating system for applications that are developed entirely in the cloud

This blog is not comprehensive guide, which could be find here https://technet.microsoft.com/en-us/library/mt126167.aspx?f=255&MSPPError=-2147217396 . I just list the steps I use to deploy and manage the Nano server.

Step 1 - Creates a bootable VHD containing Windows Server Nano 2016.

1. Download two script
    Convert-WindowsImage.ps1 https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f
    New-NanoServerVHD.ps1 https://gallery.technet.microsoft.com/scriptcenter/Create-a-New-Nano-Server-61f674f1/view/Reviews

2. Create a working folder (say, F:\NanoServer). Copy the above two scripts to that folder.

3. Download the Windows Server 2016 Technical Preview ISO (found here https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-technical-preview) to a folder (say, D:\ISO).

4. Open an Administrative PowerShell window. Change directory to the Working Folder (cd F:\NanoServer).

5. Run the command (In this case, I use DHCP instead of static IP address
.\New-NanoServerVHD.ps1 -serveriso D:\ISO\10074.0.150424-1350.fbl_impressive_SERVER_OEMRET_X64FRE_EN-US.ISO-destvhd f:\nanoserver\Nano-msg8-3.vhd -computername nano-msg8-3 -AdministratorPassword 'pass@word1' -Packages 'Storage','OEM-Drivers','Guest'

 

Step 2 - Add additional Package to the VHD

1. Make a new folder on your server called dism. From the Sources folder on the distribution media, copy these three files to the local dism folder you just created:

  • api*downlevel*.dll
  • *dism*
  • *provider*

2. Copy Packages folder from distribution media's NanoServer folder to working folder (F:\NanoServer).

3. Run the following commends and add the corresponding Packages.

cd \NanoServer

md mountdir

dism\dism /Mount-Image /ImageFile:F:\NanoServer\Nano-msg8-3.vhd /Index:1 /MountDir:.\mountdir

dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-Compute-Package.cab /Image:.\mountdir

dism\dism /Add-Package /PackagePath:.\packages\en-us\Microsoft-NanoServer-Compute-Package.cab /Image:.\mountdir

dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:.\mountdir

dism\dism /Add-Package /PackagePath:.\packages\en-US\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:.\mountdir

Step 3 - Configuring commands to run on first boot

1. Create a startup script "SetupComplete.cmd" as below. The script I used manually configure the DNS servers, disable the firewall and show IP after nano server start up.

netsh interface ip set dnsservers name="Ethernet" static 10.190.165.99 primary
netsh interface ip add dnsservers name="Ethernet" 10.156.51.2 index=2
netsh interface ip set dnsservers name="Ethernet 2" static 10.190.165.99 primary
netsh interface ip add dnsservers name="Ethernet 2" 10.156.51.2 index=2
netsh advfirewall set domainprofile state off
netsh advfirewall set privateprofile state off
netsh advfirewall set publicprofile state off
netsh advfirewall set currentprofile state off
ipconfig

2. Run the following command

md .\mountdir\Windows\Setup
md .\mountdir\Windows\Setup\Scripts
copy .\SetupComplete.cmd .\mountdir\Windows\Setup\Scripts

3. Dismount the VHD and commit the change.

dism\dism /Unmount-Image /MountDir:.\MountDir /Commit

Step 4 - Boot from the above VHD

1. Run the following command and create another boot entry.

bcdedit /copy {current} /d "VHD: Windows Server 2016 Nano"
bcdedit /set {GUID generated from the first command} device vhd=[F:]\NANOSERVER\NANO-MSG8-3.vhd
bcdedit /set {GUID generated from the first command} osdevice vhd=[F:]\NANOSERVER\NANO-MSG8-3.vhd
bcdedit /set {GUID generated from the first command} detecthal on
bcdedit /set {GUID generated from the first command} hypervisorlaunchtype auto

2. Use the above VHD boot as the default boot.

3. Restart server.

Step 5 - Join Domain

1. Open a new command windows. Harvest a data blob from a computer in the domain that is already running Windows Threshold Server using this command:
djoin.exe /provision /domain <domain-name> /machine <machine-name> /savefile \odjblob

2. Copy the above odjblob file to nano server.
net use Z: \\nano-msg8-3\c$ pass@word1 /USER:nano-msg8-3\administrator
md z:\temp
copy odjblob z:\temp

3. On another Windows Server 2016 machine (physical machine or VM) with the same build no (10074 in my case), run the following command to add nano server to the local trusted hosts lit.
Set-Item WSMan:\localhost\Client\TrustedHosts "nano-msg8-3"

4. Run the following command to open remote powershell session.
Enter-PSSession -ComputerName nano-msg8-3 -Credential nano-msg8-3\Administrator

5. Run the following command in the remote powershell window and join the nano server to the domain.
djoin /requestodj /loadfile c:\Temp\odjblob /windowspath c:\windows /localos
shutdown /r /t 5
Exit-PSSession

Step 6 - Enable remote administration

1. After Nano Server rebooted, enter remote powershell session again.
Enter-PSSession -ComputerName nano-msg8-3 -Credential nano-msg8-3\Administrator

2. Add a domain user to the local administrators group.
chcp 65001
Winrs –r:nano-msg8-3 –u:nano-msg8-3\Administrator –p:pass@word1 net localgroup Administrators /add red\administrator

3. To enable CredSSP, use this command:
winrm s winrm/config/service/auth @{CredSSP="true"} -r:nano-msg8-3 -u:red\administrator /p:pass@word1

Now you may use remove administration tool (e.g. Server Manager, Hyper-V Manager) to manage the nano server.

Comments

  • Anonymous
    July 31, 2015
    Hello, when I run the command dismdism /Add-Package /PackagePath:.packagesMicrosoft-NanoServer-Compute-Package.cab /Image:.mountdir I get an 0x80092004 error. Any ideas? Thanks!
  • Anonymous
    September 15, 2015
    The comment has been removed
  • Anonymous
    September 29, 2015
    Why not just
    "netsh advfirewall set allprofiles state off"?
  • Anonymous
    November 16, 2015
    Today’s Tip… Nano Servers are coming! Nano Server is a remotely administered server operating system
  • Anonymous
    January 03, 2016
    Hi,

    I have installed Nanoserver on baremetal system using PXE. Now I want to login to that nanoserver. How to I login PS session is not working. kindly help

    Thanks