Can you modify vmx files on multiple vms in a cluster to allow boot delay setting changes via RCLI or VI Toolkit? How?
SAs desire a boot delay of 10 seconds across virtual enterprise comprising of multiple VCs with multiple datacenters and clusters.
Known: we can modify .vmx file and add: bios.bootDelay = "10000" this adds a 10000 ms (10 seconds) delay at boot time
Known: we may have to re-register or some other mechanism to apply the change to boot settings on vms
Has anyone attempted to do an enterprise wide change to bootDelay on vms? Any help?
The script below will do what you want. Have fun.
-
#this script sets the bios boot delay for VMs
connect-viserver "your vc server name"
#define cluster, if you want to limit the scope to a single cluster, otherwise comment this line out
$cluster = Get-Cluster -Name "My Cluster"
#boot delay to configure, in milliseconds
$bootdelay = 10000
#get all of the VMs in the cluster
#just omit $cluster if you want to do all VMs in your virtualcenter at once
$vm = Get-VM -Location $cluster
$vmView = $vm | foreach-object { get-view $_.id }
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.bootoptions = New-Object VMware.Vim.virtualmachinebootoptions
$vmConfigSpec.bootoptions.bootdelay = "$bootdelay"
$vmView | foreach-object { $_.ReconfigVM($vmConfigSpec) }
The script below will do what you want. Have fun.
-
#this script sets the bios boot delay for VMs
connect-viserver "your vc server name"
#define cluster, if you want to limit the scope to a single cluster, otherwise comment this line out
$cluster = Get-Cluster -Name "My Cluster"
#boot delay to configure, in milliseconds
$bootdelay = 10000
#get all of the VMs in the cluster
#just omit $cluster if you want to do all VMs in your virtualcenter at once
$vm = Get-VM -Location $cluster
$vmView = $vm | foreach-object { get-view $_.id }
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.bootoptions = New-Object VMware.Vim.virtualmachinebootoptions
$vmConfigSpec.bootoptions.bootdelay = "$bootdelay"
$vmView | foreach-object { $_.ReconfigVM($vmConfigSpec) }
Ho can I modify the boot delay for a single VM?
Just replace the line where the script populates the $vm variable
$vm = Get-VM -Name MyVM
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference