Skip to content

Instantly share code, notes, and snippets.

@vMarkusK
Created September 19, 2016 14:57
Show Gist options
  • Save vMarkusK/a7c54bed1e46981cd5657faa4730d819 to your computer and use it in GitHub Desktop.
Save vMarkusK/a7c54bed1e46981cd5657faa4730d819 to your computer and use it in GitHub Desktop.
Fix: Rebooting Windows 8 or 2012 Server or later virtual machines fail at the Microsoft Windows boot splash screen.
<#
.SYNOPSIS
Add monitor_control.enable_softResetClearTSC = TRUE
.DESCRIPTION
Add monitor_control.enable_softResetClearTSC = TRUE to the virtual machines advanced configuration
.Example
./Windows2012-SoftResetTSC.ps1
.Notes
NAME: Windows2012-SoftResetTSC.ps1.ps1
LASTEDIT: 09/19/2016
VERSION: 1.0
KEYWORDS: VMware, vSphere, ESXi, Windows
.Link
http://mycloudrevolution.com/
#Requires PS -Version 4.0
#Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"}
#>
$ExtraOptions = @{
"monitor_control.enable_softResetClearTSC"="true";
}
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
Foreach ($Option in $ExtraOptions.GetEnumerator()) {
$OptionValue = New-Object VMware.Vim.optionvalue
$OptionValue.Key = $Option.Key
$OptionValue.Value = $Option.Value
$vmConfigSpec.extraconfig += $OptionValue
}
ForEach ($vm in (Get-VM | where {$_.Guest.GuestID -like "windows8*"})){
$vmv = Get-VM $vm | Get-View
$state = $vmv.Summary.Runtime.PowerState
($vmv).ReconfigVM_Task($vmConfigSpec)
if ($state -eq "poweredOn") {
$vmv.MigrateVM_Task($null, $_.Runtime.Host, 'highPriority', $null)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment