Created
April 7, 2014 03:59
-
-
Save nzbart/10014633 to your computer and use it in GitHub Desktop.
Create a Hyper-V virtual machine for a VHD downloaded from http://modern.ie
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
$vhd = ls *.vhd | select -ExpandProperty Name | |
if(!$vhd -or $vhd.GetType().FullName -ne 'System.String') { | |
throw "Expected to find the VHD in the current directory." | |
} | |
$vmName = [System.IO.Path]::GetFileNameWithoutExtension($vhd) | |
Write-Host "Creating VM called $vmName..." | |
$newVm = New-VM -Name $vmName -MemoryStartupBytes 1024MB -SwitchName External -VHDPath (Resolve-Path $vhd) -Path . -Generation 1 -BootDevice IDE | |
$newVm | Set-VMProcessor -Count 2 | |
$newVm | Set-VMMemory -DynamicMemoryEnabled $true -Buffer 100 | |
$newVm | Start-VM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment