Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $PathtoWin2016Sources = "D:"
- $BasePath = "C:\NanoLab\Base"
- $Demo1ServerName = "NanoLab-Nano1"
- $TargetVHDPath = "C:\NanoLab\$Demo1ServerName"
- #Hyper-V Settings
- $ExternalSwitchName = "Internal"
- #####
- # Import the NanoServer Image Generator Powershell Module
- Import-Module "$PathtoWin2016Sources\NanoServer\NanoServerImageGenerator.psm1"
- #####
- # Create a new VHDX file for a VM (-GuestDrivers)
- New-NanoServerImage
- -MediaPath $PathtoWin2016Sources
- -BasePath $BasePath
- -TargetPath "$TargetVHDPath\$Demo1ServerName.vhdx"
- -ComputerName $Demo1ServerName
- -GuestDrivers
- #####
- # create a Virtual Machine
- New-VM
- -VHDPath "$TargetVHDPath\$Demo1ServerName.vhdx"
- -Name $Demo1ServerName
- -Path $TargetVHDPath
- -Generation 2
- -SwitchName $ExternalSwitchName
- -MemoryStartupBytes 256MB
- #####
- # Boot the VM
- Start-VM -Name $Demo1ServerName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement