Advertisement
Guest User

ITProConNYC2016-WinTrack-NanoServer-1

a guest
Mar 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $PathtoWin2016Sources = "D:"
  2. $BasePath = "C:\NanoLab\Base"
  3. $Demo1ServerName = "NanoLab-Nano1"
  4. $TargetVHDPath = "C:\NanoLab\$Demo1ServerName"
  5.  
  6. #Hyper-V Settings
  7. $ExternalSwitchName = "Internal"
  8.  
  9. #####
  10. # Import the NanoServer Image Generator Powershell Module
  11.  
  12. Import-Module "$PathtoWin2016Sources\NanoServer\NanoServerImageGenerator.psm1"
  13.  
  14. #####
  15. # Create a new VHDX file for a VM (-GuestDrivers)
  16.  
  17. New-NanoServerImage
  18.     -MediaPath $PathtoWin2016Sources
  19.     -BasePath $BasePath
  20.     -TargetPath "$TargetVHDPath\$Demo1ServerName.vhdx"
  21.     -ComputerName $Demo1ServerName
  22.     -GuestDrivers
  23.  
  24. #####
  25. # create a Virtual Machine
  26.  
  27. New-VM
  28.     -VHDPath "$TargetVHDPath\$Demo1ServerName.vhdx"
  29.     -Name $Demo1ServerName
  30.     -Path $TargetVHDPath
  31.     -Generation 2
  32.     -SwitchName $ExternalSwitchName
  33.     -MemoryStartupBytes 256MB
  34.  
  35. #####
  36. # Boot the VM
  37. Start-VM -Name $Demo1ServerName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement