Customize Nano server deployment during creation

$NanoVHDPath = "D:\VMs\NanoVM2\NanoServerVM.vhd"
$VHDMount = Mount-VHD -Path $NanoVHDPath -Passthru
$DriveLetter = $VHDMount | Get-Disk | Get-Partition | Get-Volume | Select-Object -ExpandProperty DriveLetter
$UnattendFile = $DriveLetter + ":\Windows\Panther\Unattend.xml"

$xml = [xml](gc $UnattendFile)

$child = $xml.CreateElement("TimeZone", $xml.unattend.NamespaceURI)
$child.InnerXml = "Central Standard Time"
$null = $xml.unattend.settings.Where{($_.Pass -eq 'oobeSystem')}.component.appendchild($child)

$xml.Save($UnattendFile)
Dismount-VHD -Path $NanoVHDPath

Comments