Creating a Hyper-V host with Nano Server - Part 1
Recently I decided to re-build my home lab cleanly with Windows Server 2016 and System Center 2016. Amongst my collection of disused components includes an older laptop workstation which has decent specifications and would make a good Hyper-V host. So I decided to try my hand at making this machine a Nano Server and manage it via SCVMM. There are many blogs out in the interwebs that describe this, but I thought I'd document my journey as well. In this post I'll outline getting the Nano Server VHD image created and getting the physical machine setup to boot to the VHD.
Create the Nano Server image
The first step of this process is to create the Nano Server image. There are a number of good blog posts that tell you how to do this, but I'll give you the short version.
- Mount the Windows Server 2016 media
- Under the root of the Windows Server 2016 media, there is a folder called Nano Server. Under this is a folder called NanoServerImageGenerator. Copy this to your local drive.
- Open a PowerShell session as an administrator and navigate to the NanoServerImageGenerator folder which was copied locally.
- Enter the following command, changing the parameters to suit your needs
new-nanoserverimage -computerName RageNanoHV01 -edition Standard -deploymentType host -mediaPath "e:\" -basePath .\Base -TargetPath .\NanoServerPhysical\NanoServer1.vhd -oemDrivers -compute -clustering -package Microsoft-NanoServer-SCVMM-Package,Microsoft-NanoServer-SCVMM-Compute-Package
A couple of notes about the command above - you can read the documentation for the new-NanoServerImage cmdlet yourself, but note the -deploymentType parameter is "host" as opposed to "guest" as it would be for a virtualized Nano Server image. The other piece is that I've included the packages supporting SCVMM explicitly when creating the VHD. Theoretically you can add these packages after the server is deployed (more on that later) but I ran into a number of issues with this and eventually corrupted my image. Otherwise, replace the -computerName, -mediaPath (location of your Windows Server 2016 media) and -targetPath values with what makes sense for your environment and the script will create a VHD with your Nano Server image.
Create the bootable drive
The next step is to create bootable media. Again, there a number of blogs on how to create a VHD and boot a physical computer to it, but here's the short steps.
- Find a trusty USB you don't mind erasing
- Download and install the latest Windows Assessment and Deployment Kit (ADK)
- Open an administrative command prompt and type the following command
makeWinPEMedia /ufd c:\temp\winpe_amd64 f:
- Change f: to wherever your USB is located. Accept the prompt asking if you want to erase your media and, voila, you have a bootable USB
- Copy the Nano Server image VHD you created in the steps above to the USB drive
Configure Boot to VHD (Native Boot)
I'll summarize these steps as well, but lifted from Boot to VHD (Native Boot): Add a Virtual Hard Disk to the Boot Menu
- Plug your USB into the physical computer and reboot
- Bring up your boot menu and boot to the USB device
- The Windows PE environment will launch
- Execute the following diskpart commands
diskpart select disk 0 clean create partition primary size=300 format quick fs=ntfs assign letter=s active create partition primary format quick fs=ntfs assign letter=c exit copy F:\NanoServer1.vhd c: diskpart select vdisk file=c:\NanoServer1.vhd attach vdisk list volume select volume (number where the vhd is mounted) assign letter=v exit cd v:\windows\system32 bcdboot v:\windows diskpart select vdisk file=c:\NanoServer1.vhd detach vdisk exit
And that's it. When you restart the computer it will now launch to the Nano Server VHD image you copied to the physical machine. Note that the location of your USB bootable media may be different, but you can see this in diskpart.
Part II will cover configuring the headless Nano Server via PowerShell remoting and getting it on the domain and ready to do work.