Forum Discussion
Installing server updates with WAC
Same here, since updating to WAC 1910. If I select schedule restart and set a time, the server always reboots immediately.
I've tried different browsers, but the behavior is consistent across browsers and Server OS versions (2012 R2 and 2019). I've also tried leaving the browser open to the update page, with the scheduled restart selected. It certainly behaves as if there's a bug in their code that's ignoring the scheduled restart.
After a little digging, I think I know where the problem resides, but don't know where else to file a bug report.
The PS module named Microsoft.SME.WindowsUpdate defines the function "Install-windowsUpdates" with a parameter for $restartTime.
When using WAC, the javascript takes your $restartTime and generates as script using the Install-WindowsUpdates function, but gives it the restartTime in a format that is invalid for powershell.
Example:
This line is from the PS script WAC created on the managed server to trigger the updates....
$restartTime = 'Fri Jan 10 2020 10:00:20 GMT-0500 (Eastern Standard Time)';
The function later uses $restartTime in order to calculate a $waitTime for shutdown.exe,
$waitTime = [decimal]::round(((Get-Date $restartTime) - (Get-Date)).TotalSeconds);
If you simply run
get-date -date 'Fri Jan 10 2020 10:00:20 GMT-0500 (Eastern Standard Time)';
It throws an error, indicating this date string is invalid.
So they need to make sure the restartTime string passed from Javascript to Powershell is in a format powershell can work with.