- On the VM host, mount Server 2016 installation ISO:
$Server2016ISOPath = 'D:\iso\WinServer2016.iso'
$MountResult = Mount-DiskImage -ImagePath $Server2016ISOPath `
-PassThru
$MountResult | Select-Object -Property *
- Determine the drive letter(s) of mounted ISO(s), including the colon (:):
$Server2016InstallationRoot = ($MountResult |
Get-Volume |
Select-object -ExpandProperty Driveletter) + ':'
$Server2016InstallationRoot
- Get the path of the NanoServerImageGenerator module within the server installation disk:
$NanoServerFolder = `
Join-Path -Path $Server2016InstallationRoot `
-ChildPath 'NanoServer'
$NsigFolder = Join-Path -Path $NanoServerFolder `
-ChildPath 'NanoServerImageGenerator'
- Review the contents of the NanoServerImageGenerator module folder:
$NsigFolder
Get-ChildItem -Path $NsigFolder -Recurse
- Import the NanoServerImageGenerator module and review the commands it contains:
Import-Module -Name $NanoServerImageGeneratorModuleFolder
Get-Command -Module NanoServerImageGenerator
- Designate the folder for the base Nano Server images:
$NanoBaseFolder = 'C:\NanoBase'
- Designate the folder for the VM images:
$VMFolder = 'D:\VMs'
- Define the Nano Server computer name and file paths for your Nano Server VM:
$NanoComputerName = 'NANO1'
$NanoVMFolder = Join-Path -Path $VMFolder
-ChildPath $NanoComputerName
$NanoVMPath = Join-Path -Path $NanoVMFolder `
-ChildPath "$NanoComputerName.vhdx"
- Create a Nano Server VM image, as a guest VM within Hyper-V and prompt for the administrator password:
New-NanoServerImage -DeploymentType Guest -Edition Datacenter
-MediaPath $Server2016InstallationRoot `
-BasePath $NanoBaseFolder `
-TargetPath $NanoVMPath `
-ComputerName $NanoComputerName
- Define a VM switch for your Nano Server:
$SwitchName = Get-VMSwitch |
Select-Object -ExpandProperty Name -First 1
- Create a new VM in Hyper-V using the Nano Server VM image:
New-VM -VHDPath $NanoVMPath -Name $NanoComputerName `
-Path $NanoVMFolder `
-SwitchName $SwitchName `
-Generation 2 -Verbose
- Start your new Nano Server VM:
Start-VM -Name $NanoComputerName -Verbose