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

Veeam SoftwareOnline advertising  specialist
Previously, on our Nano Server Deployment series, we've created a new nano server image 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


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 a test environment, so I set the 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 the restriction for PowerShell remoting. I used an asterisk to allow any computer in my lab to connect remotely. Don’t do this in production. Instead, the 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.

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

$additional_disk=Get-Disk | Where-Object PartitionStyle –Eq "RAW"
Initialize-Disk $additional_disk.Number
New-Partition -DiskNumber $additional_disk.Number -UseMaximumSize -AssignDriveLetter | Format-Volume -NewFileSystemLabel "VMs" -FileSystem ReFS
  • The first command is to get information      about all connected disks
  • The second line is to select disk with RAW      partition
  • The third line will initialize selected disk
  • The fourth command will create a new partition with maximum size and format it with ReFS file system.

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 switch you can skip this step.

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

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


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.

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

Set-DnsClientServerAddress -InterfaceIndex 6 -ServerAddresses ""
  • The first command is to identify ID of newly created switch
  • With second command we are setting new DNS server

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

The 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"

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. 

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.

Want to learn everything about Nano Server? Access the following free resources:


Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.