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 a Nano Server VM for Windows Server containers

Once the image is created, you need to create a virtual machine from this VHD(X).

The following is a quick PowerShell script that will create a Nano VM for you:

#variables$vSwitchName01="Ext_vSwitch01"$InstallRoot="D:\VMs\NANOVM-CRHOST"$VMName="NANOVM-CRHOST"$adminPassword="P@ssw0rd"$localCred=new-object-typenameSystem.Management.Automation.PSCredential`             -argumentlist"Administrator",(ConvertTo-SecureString$adminPassword-AsPlainText-Force)$IP="172.16.20.185"$GWIP="172.16.20.1"$DNSIP="172.16.20.9"# Create VMNew-VHD-Path($InstallRoot+"\NANOVM-CRHOST_D.vhdx") -SizeBytes50GB-DynamicNew-VM-VHDPath($InstallRoot+"\NANOVM-CRHOST.vhdx") -Generation2-MemoryStartupBytes4GB` -Name$VMName-Path$InstallRoot-SwitchName$vSwitchName01Set-VMMemory-VMName$VMName-DynamicMemoryEnabled$falseSet-VMProcessor-VMName$VMName-Count4Set-VM-VMName$VMName-AutomaticStopActionShutDown-AutomaticStartActionStartIfRunningEnable-VMIntegrationService$VMName-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