We had the same problem and SCCM was just as bad so we run a script with a "timeguard" in it:
'No resume next in the script
strComputer = "."
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
ShutdownWindowStart=cdate("02:45:00 AM")
ShutdownWindowStop=cdate("03:15:00 AM")
DeviceTime=Time
'wscript.echo Time ' for testing only
If DeviceTime>ShutdownWindowStart And DeviceTime<ShutdownWindowStop Then
'wscript.echo "Shutdown In 100 Secs" ' for testing only
objShell.Run "C:\WINDOWS\system32\shutdown.exe -r -f -t 100"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\RestartAcceptedLogSCCM.txt",2,true)
Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
objFile.WriteLine "Machine Shutdown Log"
objFile.WriteLine "The Machine " & strComputerName & " attempted a restart at " & DeviceTime
objFile.WriteLine "This was in the Shutdown Start/Stop Window"
objFile.Close
else
'wscript.echo "Not the right time" ' for testing only
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\RestartAbortedLogSCCM.txt",2,true)
Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
objFile.WriteLine "Machine Shutdown Log"
objFile.WriteLine "The Machine " & strComputerName & " attempted a restart at " & DeviceTime
objFile.WriteLine "This was aborted due to being outside the Shutdown Start/Stop Window"
objFile.Close
End if
------------------------------
Trusted Advisor, United Kingdom.
------------------------------
Original Message:
Sent: 08-02-2021 04:49 PM
From: Dale Anderson
Subject: altiris "client task schedules" not running on schedule
Hello,
Setup several client task schedules to reboot computers at 8 pm user time on Sunday night. A set of computers, one for every week. So this week the first week Sunday night 8/1 at 8 PM the Pilot group (most of them) kicked off and completed. So this morning on the second group of servers that are supposed to reboot on Sunday night the next week kicked off at 10AM. So at the time they kicked off was about the time I disabled the Weekly reboots cause the first one went a week early. I had to change the date so the next set would kick off on the 3rd Sunday of this month. I then ran an update and some of the servers that were supposed to run the 3rd Sunday kicked off and started rebooting.
So for now all the schedules are turned off for the weekly reboots.
Why would this happen?
How to prevent it from happening in the future?
I have had similar things happen in the past when I went to change the client schedule task - either A. they did not run at all B. they ran when they ran but not on a schedule C. They ran correctly (most of them).
Thanks for taking the time to look at this and possibly give some answers.
Thanks.
Dale