VMWare: Windows 8 and Windows 2012 Server virtual machines fail upon reboot

Sometimes, Windows 2012 R2 servers hang at the splash screen (spinning dots) and never boot. The reason behind this is that starting with Windows 8/Windows 2012 Server, during the boot process, the operating system resets the TSC (TimeStampCounter, increments by 1 for each passed cycle) on CPU0 when it detects it to be equal or larger than 0x40000000000000.

Unfortunately... This does not happen... The reset that is. The system basically stays in a wait-a-like-state for an extremely long time. For servers that cannot be updated to the latest 5.x version or 6.x for that matter, use the following setting as a workaround.

monitor_control.enable_softResetClearTSC = true

If you don't run any solaris machines, you could also just ssh into the host and simply do a one-liner

vim-cmd vmsvc/getallvms | sed -n 's/\(^[0-9]\+\).* windows8.*Guest.*$/\1/p' | while read vmid; do state=$(vim-cmd vmsvc/power.getstate ${vmid} | sed -n 's/^.*\(Powered on\).*$/\1/p'); if [ "$state" ]; then vim-cmd vmsvc/power.suspendResume ${vmid} && sleep 5; fi; done;

Or use powershell on the windows host:

# Script intended to workaround the bug where Windows Server 2012+ systems on VM Hardware v10 will hang at the splash screen.

Set-PSDebug -Strict
 
# Initialize the toolkit:
if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null ) {
    Add-PsSnapin VMware.VimAutomation.Core
}
[Reflection.Assembly]::LoadWithPartialName("VMware.Vim")
 
# Connect to your vmware virtual center:
$viServ = "FULLHOSTNAMEHERE"
Connect-VIServer -Server $viServ
 
# Get all VMs in the vCenter:
$vms = Get-VM
# Loop through the virtual machines:
ForEach ($vm in $vms){
    # Get a "View" object for each VM.
    $vmv = Get-VM $vm | Get-View
    $name = $vmv.Name
    $guestid = $vmv.Summary.Config.GuestId
     
    if ($guestid -like "windows8*Guest") {
        # "windows8*Guest" will match Windows 8 as well as 
        # "windows8Server64Guest" (Windows Server 2012 & 2012 R2).
         
        # Update the VMX file
        $vmx = New-Object VMware.Vim.VirtualMachineConfigSpec
        $vmx.extraConfig += New-Object VMware.Vim.OptionValue
        $vmx.extraConfig[0].key = "monitor_control.enable_softResetClearTSC"
        $vmx.extraConfig[0].value = "TRUE"
        ($vmv).ReconfigVM_Task($vmx)
        write-host "Edited" $vmv.name  
        $vmv.name | out-file -FilePath c:\debug.txt -NoClobber -Append
    }
}

Do note these settings don't apply until you do a cold start!

Author: Angelique Dawnbringer Published: 2016-02-18 22:09:55 Keywords:
  • VMWare
  • Microsoft Windows
  • Failure on reboot
Modified: 2017-09-10 17:47:01