network-based installation option

May 4, 2012 at 1:37 AM


   I found the following snippet which works great:

new-vm $SRV1 -path $VMLoc
new-vhd -vhdpaths $VMLoc\$SRV1 -size $SRV1VHD
add-vmdisk -vm $SRV1 -controllerid 0 -lun 0 -path $VMLoc\$SRV1
get-vm $SRV1 | add-vmdrive -controllerid 1 -lun 0 -dvd
get-vm $SRV1 | set-vmmemory -memory $SRAM
get-vm $SRV1 | add-vmnic -virtualswitch $Network1


The only thing is that I need to set the option "Install an operating system from a network-based server". How do I do that please?


David Z

May 4, 2012 at 2:16 AM

Found the answer...I also had to modify the last line above to make it legacy. My last two lines are now:

get-vm $SRV1 | add-vmnic -virtualswitch $Network1 -legacy
set-vm $SRV1 -bootorder 3,1,2,0

the numbers on the boot order can be found by searching MSDN for the Msvm_VirtualSystemSettingData class

Hope this helps someone one day!



David Z