I was trying to troubleshoot a Linux VM yesterday and the VM Console from vCenter would be too slow after a reset, so that I could not modify the kernel boot parameters, because by the time it displayed anything, there was already a kernel panic message and I had an unresponsive VM.
So I ticked the Force BIOS Setup option, to force the VM to go on to the BIOS screen on booting up. I removed quiet from the kernel entry in GRUB but all I got was a message saying that I should disable SElinux and after I went through the whole thing again and managed to boot up again without making any changes to the kernel entry, I thought I had better look for a PowerCLI solution, so here it is:
So I ticked the Force BIOS Setup option, to force the VM to go on to the BIOS screen on booting up. I removed quiet from the kernel entry in GRUB but all I got was a message saying that I should disable SElinux and after I went through the whole thing again and managed to boot up again without making any changes to the kernel entry, I thought I had better look for a PowerCLI solution, so here it is:
- Fire up VMware vSphere PowerCLi.
- Connect to vCenter (Connect-VIServer vcenterserver)
- Import-Module -Name .\VMware.Vim.dll
- $ida = get-vm -name ida
- $idaVMBO = New-Object VMware.Vim.VirtualMachineBootOptions
- $idaVMBO.EnterBIOSSetup=$true
- $idaVMCS = New-Object VMware.Vim.VirtualMachineConfigSpec
- $idaVMCS.BootOptions = $idaVMBO
- $idaView = Get-View -VIObject $ida
- $idaView.ReconfigVM($idaVMCS)
- restart-vm $ida
- $idaView.ReconfigVM($idaVMCS)
- restart-vm $ida -confirm:$false
function Set-VMBootToBIOS
ReplyDelete{
param (
$VMs,
[bool]$BootToBIOS = $true
)
$vmbo = New-Object VMware.Vim.VirtualMachineBootOptions
$vmbo.EnterBIOSSetup = $BootToBIOS
$vmcs = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmcs.BootOptions = $vmbo
foreach ($VM in $VMs)
{
if ($VM.typename -eq "VMware.VimAutomation.ViCore.Impl.V1.VM.UniversalVirtualMachineImpl")
{
$VM = $VM.name
}
$view = Get-View -VIObject $VM
$view.ReconfigVM($vmcs)
}
}
Set-VMBootToBIOS $(get-vm KIL*10VW-*) -BootToBIOS $true
Delete