O'Reilly logo

Getting Started with Nano Server by Charbel Nemnom

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Nano virtual machines

Once the Virtual Hard Disks (VHDX) are created, you can simply copy them to your Hyper-V server and create a new virtual machine. It's worth noting that the VM must be a generation 2 VM, because you cannot attach a VHDX file to a generation 1 VM in the case of Nano Server.

To automate this process, you can run the following PowerShell script on your Hyper-V server:

 #region create 5 NANO VIRTUAL MACHINES #variables$vSwitchName01="vSwitch"$InstallRoot="D:\Hyper-V"#endregion1..5|ForEach-Object{New-VHD-Path($InstallRoot+"\NANOVM-OM0$_\NanoServer_D.vhdx") -SizeBytes50GB-DynamicNew-VM-VHDPath($InstallRoot+"\NANOVM-OM0$_\NANOVM-OM0$_.vhdx") -Generation2-MemoryStartupBytes4GB-NameNANOVM-OM0$_-Path$InstallRoot-SwitchName$vSwitchName01Set-VMProcessor-VMNameNANOVM-OM0$_-Count4Set-VM-VMNameNANOVM-OM0$_-AutomaticStopActionShutDown-AutomaticStartActionStartIfRunningEnable-VMIntegrationServiceNANOVM-OM0$_-Name"Guest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required