Created
April 21, 2017 18:56
-
-
Save PixelRobots/e2121985c9662a99a20139fcad3b6724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VMName = "PIXEL-SRV01" | |
[int64]$VMMem = 1MB*1024 #chnage to 1gb* the number of gb if you need. | |
$VMGen = "2" | |
$VHDPath = "V:\Hyper-V\$VMname\Virtual Hard Disks\$VMName.VHDX" | |
$VMPath = "V:\Hyper-V\" | |
[int64]$VMSize = 1GB*40 | |
$ISOPath = "C:\ISO\en_windows_server_2016_x64_dvd_9327751.iso" | |
new-vm -Name $VMName -path $VMPath -MemoryStartupBytes $VMMem -Generation $VMGen -NewVHDPath $VHDPath -NewVHDSizeBytes $VMSize -BootDevice vhd | |
Add-VMDvdDrive $VMName | |
Start-Sleep -Seconds 5 | |
Set-VMDvdDrive -VMName $VMName -Path $ISOPath -ToControllerNumber 0 -ToControllerLocation 1 | |
Start-Sleep -Seconds 5 | |
$dvd = Get-VMDvdDrive -VMName $VMName | |
Set-VMFirmware -VMName $VMName -FirstBootDevice $dvd | |
Start-Sleep -Seconds 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment