Hi guys,
I've encountered an issue about scheduled reboot for windows updates installation via WAC with this version of modernized gateway.
If I install any patch and schedule the reboot the sever will always reboot immediately after patch installation.
After some digging, I think I know where the problem resides:
When using WAC, the javascript takes your input date and time as a $restartTime variable that is formatted in en-US regional date format. Problem is, our servers are using Italian Regional format data. Thus, the date difference that the script is evaluating to determine the wait time for the shutdown command fails and so the server reboots immediately:
$waitTime = [decimal]::round(((Get-Date $restartTime) - (Get-Date)).TotalSeconds);
This difference between date items is failing because the output of the command "Get-Date" in our servers is localized in Italian, while the $restartTime variable is using english format.
This means that the scheduled reboot feature will not work for all servers where regional format data is not the same as the "en-US" standard.
I've also tried to elaborate some fix, using the "-Format" option for the Get-Date command and the Net-TimeSpan function. in order to normalize the Date items before calculating the waitTime value for shutdown.
$currdate = Get-Date -Format "u"
$convRestartTime = Get-Date $restartTime -Format "u"
$waitTime=[decimal]::Round((New-TimeSpan -Start $currDate -End $convRestartTime).TotalSeconds)
Can you fix this problem? Scheduled reboots for windows updates is a key feature in WAC.
Do you have any other suggestion about this issue?
Thanks for any input on this.
Alessandro