Created
March 14, 2015 04:17
-
-
Save blha303/5be46163af65e8435e7e to your computer and use it in GitHub Desktop.
Set up test vm in hyper-v
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
function Connect-VM { | |
param( | |
[Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, Position=1)] | |
[Microsoft.HyperV.PowerShell.VirtualMachine[]]$VM, | |
[switch] $PassThru | |
) | |
PROCESS { | |
foreach ($VMobject in $VM) { | |
vmconnect localhost ($VMobject.name) | |
} | |
if($PassThru) {$_} | |
} | |
} | |
new-vmswitch -name Int | |
new-vm -name 'testvm' -MemoryStartupBytes 1GB -SwitchName Int | |
add-vmdvddrive testvm -path "t:\wineval\8.1 Eval.iso" | |
new-vhd -dynamic c:\testvm.vhdx -sizebytes 20GB | |
Add-VMHardDiskDrive testvm -path c:\testvm.vhdx | |
get-vm -name testvm | start-vm -passthru | connect-vm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment