Last active
December 13, 2016 07:13
-
-
Save goffinet/600a0d39bc908f0d1a91dadacd5a67b4 to your computer and use it in GitHub Desktop.
posh create vm windows 2016 14393
This file contains hidden or 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
| # | |
| #Set VM Name, Switch Name, and Installation Media Path. | |
| $VMname = 'TESTVM' | |
| #$Switch = 'NatSwitch' | |
| $Switch = 'VmNAT' | |
| $ISO = 'C:\Users\Administrator\Downloads\14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO' | |
| $VHD = 'C:\Users\Administrator\Documents\' | |
| $VHDSize = 40 GB | |
| $RAM = 4 GB | |
| #Create New Virtual Machine | |
| New-VM -Name $VMname -MemoryStartupBytes 4GB -Generation 2 -NewVHDPath $VHD"$VMname\$VMName.vhdx" -NewVHDSizeBytes 40GB -Path $VHD"$VMname" -SwitchName $Switch | |
| #Add DVD Drive to Virtual Machine | |
| Add-VMScsiController -VMName $VMname | |
| Add-VMDvdDrive -VMName $VMName -ControllerNumber 1 -ControllerLocation 0 -Path $ISO | |
| #Mount Installation Media | |
| $DVDDrive = Get-VMDvdDrive -VMName $VMname | |
| # Configure Virtual Machine to Boot from DVD | |
| Set-VMFirmware -VMName $VMname -FirstBootDevice $DVDDrive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment