I’m trying to have a reboot occur at a particular time after patching has been applied on a machine. I want the machines to reboot at 8:10am, after giving the users a 5 minute warning, in case they are on. If the patching completes before 8am, I’d like the reboot to happen today at 8:10am, otherwise, happen tomorrow at 8:10am
Here is the code I am trying to use to set the Scheduled task to perform the reboot:
if {two digit hour of it of time (local time zone) of now as integer < 8}
parameter “run_date” = “{(month of it as two digits & "/" & day_of_month of it as two digits & "/" & year of it as string) of current date}”
else
parameter “run_date” = “{(month of (it + 1*day) as two digits & "/" & day_of_month of (it + 1*day) as two digits & "/" & year of (it + 1*day) as string) of current date}”
endif
dos schtasks /create /ru system /rl highest /sc once /tn reboot_8am /tr "shutdown /r /f /t 300 /c \"Testing your computer and a 8:10am reboot has been scheduled. PLEASE SAVE ALL WORK prior to the reboot."" /sd {parameter “run_date”} /st 08:05 /F
Eventually, I might include a file that contains the time to perform the reboot, so the same action can be applied to a group of machines, and that file will be used to determine the time of reboot.
Any help would be great,
Bob_K