Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Everything you can do in the VMM Beta 2 Administrator Console you can do on the command line. Our PM puts it best, "Our API is the customer's API".
For example, a beta VMM user recently asked "How can I specify which bus/lun I want to assign myHD to when I create a new vm? It seems that New-VM isn’t happy if you don’t pass it a –virutalharddisk parameter so I can’t seem to create the VM first and then use Add-VirtualHardDisk."
You can do this in a job group, here’s an example that shows creating a vm in a job group that adds a VHD to IDE 1,0 and adds a NIC:
$job = [Guid]::NewGuid().ToString()
New-VirtualNetworkAdapter -VMMServer localhost -JobGroup $job -EthernetAddressType Dynamic
Add-VirtualHardDisk -JobGroup $job -Bus 1 -Lun 0 -VirtualHardDisk $VirtualHardDisk -IDE
New-VM -VMMServer localhost -Name $name -VMHost $VMHost -Path $path -HardwareProfile $HardwareProfile -JobGroup $job -runasynchronously
You can use this to do new-vm related cmndlets before calling the new-vm itself (such as adding VHDs or adding a NIC in this example)