Skip to content

Instantly share code, notes, and snippets.

@jonathanelbailey
Created October 7, 2015 21:23
Show Gist options
  • Save jonathanelbailey/ca6f2799593f3d1980ef to your computer and use it in GitHub Desktop.
Save jonathanelbailey/ca6f2799593f3d1980ef to your computer and use it in GitHub Desktop.
A set of functions that create a Virtual Machine and its VHD.
New-RdpVmConfig{
Param( $Name,
$SwitchName,
$VhdPath,
$Path )
BEGIN{}
PROCESS{
New-VM -Name $Name -MemoryStartupBytes 2048 -BootDevice VHD -SwitchName $SwitchName -VHDPath $VhdPath -Path $Path -Generation 1
Set-VM -Name $Name -ProcessorCount 4 -DynamicMemory $true -MemoryMinimumBytes 2048
Enable-VMIntegrationService -VMName $Name
}
END{
$Result = get-vm -Name $Name
Write-Output $Result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment