- From your Hyper-V host, view the currently installed package providers:
Get-PackageProvider
- View the available package providers online, noting the NanoServerPackage provider:
Find-PackageProvider | Select-Object -Property Name, Summary |
Format-Table -AutoSize -Wrap
- Install the NanoServerPackage provider:
Install-PackageProvider -Name NanoServerPackage -Verbose
- View the commands included with the provider:
Get-Command -Module NanoServerPackage
- View the available Nano Server packages:
$NanoPackages = Find-NanoServerPackage |
Select-Object -Property Name, Description
$NanoPackages | Format-Table -AutoSize -Wrap
- Determine which of the available packages you wish to install, store them as an array in the $Installpackages variable and then display that array:
$InstallPackages = @('Microsoft-NanoServer-Storage-Package',
'Microsoft-NanoServer-IIS-Package',
'Microsoft-NanoServer-DSC-Package')
$InstallPackages
- Define the path to the Windows Server 2016 installation media:
$Server2016InstallationRoot = 'E:\'
- Define the path of the NanoServerImageGenerator folder:
$NanoServerFolder = Join-Path -Path $Server2016InstallationRoot
-ChildPath 'NanoServer'
$NsigFolder = Join-Path -Path $NanoServerFolder
-ChildPath 'NanoServerImageGenerator'
$NsigFolder
- Import the NanoServerImageGenerator module and review the commands contained in that module:
Import-Module -Name $NsigFolder
Get-Command -Module NanoServerImageGenerator
- Define the folders for the base Nano Server images and the VM images:
$NanoBaseFolder = 'C:\NanoBase'
$VMFolder = 'D:\VMs'
- Define paths for the Nano Server VM:
$NanoComputerName = 'NANO2'
$NanoVMFolder = Join-Path -Path $VMFolder
-ChildPath $NanoComputerName
$NanoVMPath = Join-Path -Path $NanoVMFolder
-ChildPath "$NanoComputerName.vhdx"
- Define the networking parameters:
$IPV4Address = '10.10.10.132'
$IPV4DNS = '10.10.10.10','10.10.10.11'
$IPV4Gateway = '10.10.10.254'
$IPV4SubnetMask = '255.255.255.0'
- Build a hash table $NanoServerImageParameters to hold parameters for the New-NanoServerImage cmdlet:
$NanoServerImageParameters = @{
DeploymentType = 'Guest'
Edition = 'DataCenter'
TargetPath = $NanoVMPath
BasePath = $NanoBaseFolder
DomainBlobPath = $DomainJoinBlobPath
Ipv4Address = $IPV4Address
Ipv4Dns = $IPV4DNS
Ipv4Gateway = $IPV4Gateway
IPV4SubnetMask = $IPV4SubnetMask
Package = $InstallPackages
}
- Create a new Nano Server image, passing in configuration parameters using splatting:
New-NanoServerImage @NanoServerImageParameters
- Once complete, review the VM switches available, and define the Hyper-V switch to use:
Get-VMSwitch | Select-Object -ExpandProperty Name
$SwitchName = 'Internal'
- Create the Nano virtual machine from the newly created VM disk, and start the VM:
New-VM -VHDPath $NanoVMPath `
-Name $NanoComputerName `
-Path $NanoVMFolder `
-SwitchName $SwitchName `
-Generation 2 -Verbose |
Start-VM