VMware Support Community
kdunn127
Contributor
Contributor

Win Update forced reboot of host

We are using VM Workstation 16 Pro and Server 2016.  We have noticed a difference in behavior between a normal reboot / shutdown, and a forced reboot by Windows Update on the Server 2016 host.  In normal conditions we have a Shutdown batch file in the local policy that soft stops 2 VMs.  When Windows Update forces a reboot of the host, The VMs are just killed and we get the unexpected shutdown messages on the VMs.  Is there a solution to detecting this kind of reboot and softly shutting down the VMs?

0 Kudos
2 Replies
s_wieland
Enthusiast
Enthusiast

Hi @kdunn127

I think you can't solve how Windows Updates does the reboot, but you can change the behavior how the reboot is initiated. I assume that you have currently set the Windows Update Policy to install update and reboot the server automatically. Maybe you have the chance to change it to install the updates only without rebooting. And then checking with a daily or weekly scheduled task, if a reboot due to Windows Updates is required and if it is, you can trigger your shutdown script and initiate the reboot.

 

Using powershell you can check if a Windows Update requires a reboot by execution the following command:

$Systeminfo= New-Object -com "Microsoft.Update.SystemInfo"
$UpdateSession = New-Object -com "Microsoft.Update.Installer"
    
if ($UpdateSession.RebootRequiredBeforeInstallation -eq $false -and $Systeminfo.RebootRequired -eq $false )
{
   Write-Host ('Reboot required: NO') -ForegroundColor Green
} else {
   Write-Host("Reboot required: YES") -Fore Green
}
0 Kudos
scott28tt
VMware Employee
VMware Employee

Hopefully a moderator will move your thread now that I have reported it, to the area for Workstation Pro.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos