Last active 1440821824

Set up test vm in hyper-v

Revision 1a7b298e4d018e05fc184a862937b890dae343a3

testvm.ps1 Raw
1function Connect-VM {
2 param(
3 [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, Position=1)]
4 [Microsoft.HyperV.PowerShell.VirtualMachine[]]$VM,
5 [switch] $PassThru
6 )
7 PROCESS {
8 foreach ($VMobject in $VM) {
9 vmconnect localhost ($VMobject.name)
10 }
11 if($PassThru) {$_}
12 }
13}
14
15new-vmswitch -name Int
16new-vm -name 'testvm' -MemoryStartupBytes 1GB -SwitchName Int
17add-vmdvddrive testvm -path "t:\wineval\8.1 Eval.iso"
18new-vhd -dynamic c:\testvm.vhdx -sizebytes 20GB
19Add-VMHardDiskDrive testvm -path c:\testvm.vhdx
20get-vm -name testvm | start-vm -passthru | connect-vm