Specify the boot devices for a virtual machine

Specify the boot devices for a virtual machine

The below Powershell script is (heavily) based on this Perl script.

It uses a feature that is available with VC2.5 or later and ESX 3.5 or later.

The keyword "bios.bootDeviceClasses" allows to define the boot devices in the VMX file.

Note: this does not allow one to change the boot order !

For more info on the syntax see the Perl script.

The following example sets the boot devices of the virtual machine to the CD drive and the hard disk.


$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.extraConfig += New-Object VMware.Vim.OptionValue
$spec.extraConfig[0].key = "bios.bootDeviceClasses"
$spec.extraConfig[0].value = "allow:cd,hd"
 
(get-view (Get-VM -Name <VM-name>).ID).ReconfigVM_Task($spec)

If you want to force a boot from CD, for example for an OS deployment, only allow the CD device.

Once the OS installation is complete change the allowed boot devices to only the hard disk.

Comments

Due to a typo the boot order is hard disk followed by the CD drive.

Corrected in version 2.

Version history
Revision #:
1 of 1
Last update:
‎04-24-2008 11:19 AM
Updated by: