How to setup Hyper-V host in Nano Server – Part 3 of deployment series


Part 1 — Nano Server Creation
Part 2 — How to deploy Nano on Physical
Part 3 — How to setup Hyper-V host in Nano Server
Part 4 — How to create Hyper-V cluster

DISCLAIMER: Starting with a 1709 update, Microsoft has shifted Nano Server from being a compact server option to an optimized container image and will continue to improve it in this direction only. Please refer to release notes for more details.

Previously, on our Nano Server Deployment series, we’ve created a new Nano Server image in the part 1 and deployed it on a physical server in part 2. Now we will go through configuration.

First we need to connect remotely to that machine over PowerShell for further configuration.



Enter-PSSession -ComputerName $nanoname -Credential $cred

Setting up Nano Server with Hyper-V Role 1

As we are connected to Nano Server remotely we should verify PowerShell execution policy to avoid potential issues with some scripts later.

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Set-Item WSMan:\localhost\Client\TrustedHosts * -force

In my case I have test environment, so I set first command to Unrestricted. Be careful with this setting in production as it allows to run unsigned scripts. Later, with the Restricted or RemoteSigned parameter you can lock back the execution policy.

The second command is for removing restriction for PowerShell remoting. I used asterisk to allow any computer in my lab to connect remotely. Don’t do this in production. Instead limit allowed computers by name or IP.

Again, I recommend you to carefully use both commands in production. It’s NOT security best practice to open computer so widely.

Setting up Nano Server with Hyper-V Role 2

In the following steps, let’s add additional storage in the VMs location.

  1. Get information about all connected disks
  2. Select disk with RAW partition
    $additional_disk=Get-Disk | Where-Object PartitionStyle –Eq "RAW"
  3. Initialize selected disk
    Initialize-Disk $additional_disk.Number
  4. Create new partition with maximum size and format it with ReFS file system.
    New-Partition -DiskNumber $additional_disk.Number -UseMaximumSize -AssignDriveLetter | Format-Volume -NewFileSystemLabel "VMs" -FileSystem ReFS
Setting up Nano Server with Hyper-V Role 3

Now creating a switch. I’ll start with the Internal one. Creating Internal Switch is optional. I’m creating it for future tests only. So, if you are working with production environment and you don’t need such swich you can skip this step.


New-VMSwitch -Name "Internal Switch" -SwitchType Internal

Setting up Nano Server with Hyper-V Role 4

And now the normal switch. You can create it on any network interface. In my example I have only one, so I’ll create it on Ethernet0. AllowManagementOS parameter will enable management traffic over that switch.

$net = Get-NetAdapter -Name 'Ethernet0'

New-VMSwitch -Name "External VM Switch" -AllowManagementOS $True -NetAdapterName $net.Name

Setting up Nano Server with Hyper-V Role 5

This process will create an external switch linked to my Ethernet0 adapter. As part of this move, the IP settings are transferred to a new (virtual) adapter connected to that switch.

Setting up Nano Server with Hyper-V Role 6

Because of a known bug with Microsoft, the DNS settings are cleared and we must reset it on the newly created switch interface:

  1. Identify ID of newly created switch
  2. Set new DNS server
    Set-DnsClientServerAddress -InterfaceIndex 6 -ServerAddresses ""
Setting up Nano Server with Hyper-V Role 7

Now you should be able to log in to the Nano console with the domain credentials again. You can also check newly added switches directly in the Nano Server Recovery console.

Setting up Nano Server with Hyper-V Role 8

Last thing before we create the first VM is to set some Hyper-V default options like default paths for VM and Virtual Hard Disk, authentication type, migration limitations, etc.


Get-VMHost | Set-VMHost -MaximumStorageMigrations 2 -MaximumVirtualMachineMigrations 2 -VirtualMachineMigrationAuthenticationType Kerberos -VirtualMachinePath e:\VMs\ -VirtualMachineMigrationPerformanceOption SMB -VirtualHardDiskPath "e:\VMs\Virtual Hard Disks"


Setting up Nano Server with Hyper-V Role 9

Next step, we’ll create the new VMs located on the local storage. We can use PowerShell or Hyper-V Manager for this. Bellow PowerShell way of creation.

New-VM -Name testVM -MemoryStartupBytes 1GB -SwitchName "Internal Switch" -Generation 2 -Path "E:\VMs\" -NewVHDPath "E:\VMs\testVM\Virtual Hard Disks\testVM.vhdx" -NewVHDSizeBytes 30GB

SET-VMProcessor –VMName testVM –Count 2

Start-VM testVM

We are creating Generation 2 VM with testVM name, 2 CPU, 1GB memory, new VHDX with 30GB size and connection to my Internal Switch.

Setting up Nano Server with Hyper-V Role 10
Setting up Nano Server with Hyper-V Role 11

At this moment we have a single Nano host with the Hyper-V role installed. We should be able to run the VMs from the local Nano storage. As there are no local management tools, we must use Hyper-V Manager from a remote server or workstation or use PowerShell. In the next part of this guide, we’ll go through clustering of Hyper-V Nano.

See Also:

Table of Contents
Similar Blog Posts
Technical | June 14, 2018
Technical | May 1, 2018
Technical | December 19, 2017
Stay up to date on the latest tips and news
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam’s Privacy Policy
You're all set!
Watch your inbox for our weekly blog updates.
Veeam Data Platform
Free trial
Veeam Data Platform
We Keep Your Business Running