Running Nano from Windows Server 2016 TP3 on Hyper-V

Last week I blogged about "Running Hyper-V on Nano".  Today I want to talk about the opposite process - running Nano from Windows Server 2016 TP3 as a guest on Hyper-V.

There are a number of changes in the TP3 build that make this really easy to do.  The first is the inclusion of PowerShell scripts that streamline the process of creating a Nano virtual machine.  All you need to do is:

  1. Mount the TP3 installation media
  2. Change to the "NanoServer" directory on the TP3 installation media 
  3. Load (via dotsourcing) convert-windowsimage.ps1
  4. Load (via dotsourcing) new-nanoserverimage.ps1
  5. Look at the help for "New-NanoServerImage"
  6. Create a VHD that contains the GuestDrivers package (and any other configuration options you want to choose).

This should look something like this:

 

At the end - create a virtual machine that uses this virtual hard drive and you should be good to go.  

One important note to make: this script produces virtual hard drives for generation 1 virtual machines, so it will not boot if you attach it to a generation 2 virtual machine.
 

Once you are up and running - there is extra good news.  PowerShell Direct now works for Nano guest virtual machines too! This makes it super easy to control and interact with Nano virtual machines:

 

 

You can jump straight into a PowerShell session on your shiny new Nano virtual machine without having to worry about network configuration at all.

Cheers,
Ben

Comments

  • Anonymous
    September 17, 2015
    I think TP3 should support nested Hyper-V? However I cannot enable Hyper-V on the VM and my host is Windows Server 2016 TP3 (Boot from VHDX, if it matters). Is there any way to enable Hyper-V on the VM or should I wait for the next preview? It would be interesting to have nano servers running in nested virtualization...

  • Anonymous
    September 21, 2015
    BTW - Nano Server can also be managed with 5nine Manager for Hyper-V: channel9.msdn.com/.../5Nine-Manager-and-Nano-Server

  • Anonymous
    September 22, 2015
    The comment has been removed

  • Anonymous
    September 24, 2015
    Hi Charlie, I had the same error message. In my case I've executed the script first on Windows Server 2012, and it failed with bcdboot error message. After this I tried to do the same on a Windows Server 2012 R2 edition, and there was no error message:)

  • Anonymous
    November 17, 2017
    Some times I get the error at step "Making image bootable":Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10Copyright (C) Microsoft Corporation. All rights reserved.Version 10.0.14393.0.amd64fre.rs1_release.160715-1616INFO : Looking for the requested Windows image in the WIM fileINFO : Image 4 selected (ServerDataCenter)...INFO : Creating sparse disk...INFO : Attaching VHDX...INFO : Initializing disk...INFO : Creating EFI system partition...INFO : Formatting system volume...INFO : Setting system partition as ESP...INFO : Creating MSR partition...INFO : Creating windows partition...INFO : Formatting windows volume...INFO : Windows path (F:) has been assigned.INFO : System volume location: E:INFO : Applying image to VHDX. This could take a while...INFO : Image was applied successfully.INFO : Applying unattend file (Guest02-Unattend.xml)...INFO : Making image bootable...ERROR : bcdboot.exe failed with code 87!INFO : Log folder is C:\Users\ADMINI~1\AppData\Local\Temp\Convert-WindowsImage\fb064fbf-daec-42e4-aa94-818f72a1288aINFO : Closing Windows image...INFO : Done.Any hint? Thanks!