question

AlexanderGeorgievskiy-8053 avatar image
0 Votes"
AlexanderGeorgievskiy-8053 asked ·

Windows 2012R2 Task Sheduler stops task after gpupdate

Hi. I created group policy with scheduled task (`Windows 7+` type). Scheduled task contains multiple commands, group policy applies to Server 2012R2.

After group policy update scheduled task creates and runs successfully, but after another group policy update task stops in the middle. Task Scheduler show me successful exit code, although half of commands in the task has not been called.

This behaviour present in all 3 cases: regular group policy update, gpupdate and gpupdate /force.

I suspect this is because group policy update replaced task in the middle of running, so my questions is:
1. Is scheduled task stop-after-task-update behavior bug or feature?
2. If this is feature, is there any workaround better than putting commands into script and calling this script from scheduled task?





windows-group-policywindows-server-2012
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FanFan-MSFT avatar image
0 Votes"
FanFan-MSFT answered ·

Hi,
Thanks for sharing here!
Before going further, would you please confirm the following questions ?
How long did the task take if you run it manually?Based on my understanding , if the group policy was not refreshed , the script can run successfully, right?
How did you set the script for the task?Run on a scheduled time every day/week, or apply only once?
Also, would you please tell how did you configure the following setting :create ,replace,update? i would like do a test to confirm if it will be the same result.
12907-7201.jpg

Best Regards,
Fan



7201.jpg (55.6 KiB)
· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

Welcome to share your current situation.
Please feel free to let us know if you need further assistance.
 
Best Regards,

0 Votes 0 ·

Hi,
I am checking to see if the problem has been resolved.
If there's anything you'd like to know, don't hesitate to ask.
Best Regards,

0 Votes 0 ·
BrechtMo-4790 avatar image
0 Votes"
BrechtMo-4790 answered ·

I think I have good results with the option "Apply Once and do not reapply".

I no longer have the "task registration deleted" -> "task terminated" -> "task registered" happening at every Group Policy Update.
This behaviour is especially an issue if you schedule an indifinite task to start running at boot.
This task is terminated some seconds after it started when the boottime Group Policy update runs, rendering the option "at system startup" for the scheduled task completely unusable.

I'm not sure what the difference is with the "create" option though.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.