I recently had to write a script to perform large scale (1000+) VM deployments to hundreds of Unmanaged ESXi hosts. All of the VM's were to be Linux and each had very specific advanced settings. Most all of the settings were managed with documented commands, however two settings have proved very difficult to configure.
The first setting I found difficult was setting the BIOS Boot Order.
All of the VM's needed to PXE boot EVERY time they booted (not just the first time for the OS install). This means having to set the NIC as the first boot device in the BIOS Boot Order.
There have been some excellent writeups on this however none of them worked 100% of the time. I have found that methods, such as setting "bios.bootDeviceClasses" to "Alow:device1,device2" do not always order them as entered. After much trial and error I finally found a method that will set the NIC (or whatever valid boot device you want to use) to be the first device in the BIOS Boot Order list.
In this example I am setting the first NIC (ethernet0) as the first boot device (for a list of device names look in your .vmx file):
$vmView = Get-VM -Server <viserver> -Name <vmname> | Get-View
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.extraConfig = New-Object VMware.Vim.OptionValue
$spec.extraConfig[0].key = "bios.bootOrder"
$spec.extraConfig[0].value = "ethernet0"
$vmView.ReconfigVM_Task($spec)
The above method will nail whatever device you specify to the top of the list. In fact, it locks it there, so keep this in mind: If you manually boot into the BIOS after using this method you will be unable to modify the boot order via the BIOS screen later.
The second difficult setting (which I am still wrestling with) is setting the NUMA Memory Affinity. If anyone out there has the magic key for changing this setting via PowerCLI I would be very greatfull!
Regards,
-=Alex
Alex St. Amand
Sr. Systems Engineer, VCP | Enterprise Virtualization | AMD
-=Alex
Alex St. Amand | Principal Solutions Architect, VCP
Data Intensity, LLC. | 22 Crosby Drive, Bedford, MA 01730