The following script enables PXE boot for al the VM’s in a particular folder. After running this script, the VM’s are set to boot only from PXE, so all other options are disabled. The original part of the script is created by LucD and posted on de VMTN forums. See the source for more information.
enable-pxeboot-vm.ps1
$VC = Connect-VIServer (Read-Host "Enter vCenter server") $folder = (Read-Host "Enter folder name") $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.extraConfig += New-Object VMware.Vim.OptionValue $spec.extraConfig[0].key = "bios.bootDeviceClasses" $spec.extraConfig[0].value = "allow:net" $vms = Get-Folder -Name $folder | Get-VM foreach ($vm in $vms){ (get-view ($vm).ID).ReconfigVM_Task($spec)} Disconnect-VIServer -Confirm:$False
If you want to return to the default settings, you can run the next script:
disable-pxeboot-vm.ps1
$VC = Connect-VIServer (Read-Host "Enter vCenter server") $folder = (Read-Host "Enter folder name") $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.extraConfig += New-Object VMware.Vim.OptionValue $spec.extraConfig[0].key = "bios.bootDeviceClasses" $spec.extraConfig[0].value = "allow:hd,cd,fd" $vms = Get-Folder -Name $folder | Get-VM foreach ($vm in $vms){ (get-view ($vm).ID).ReconfigVM_Task($spec)} Disconnect-VIServer -Confirm:$False
Source: LucD @ http://communities.vmware.com/thread/196651