Score:0

Group Policy scheduled task for running .bat file applies, but task does not create

tc flag

I am trying to add a scheduled task to run a batch file that updates / installs software. I created a GPO to create the task, using these settings:

Task Settings

Task settings 2

Task settings 3

For one of them, I am using item level targeting to only apply to one group. But this issue is happening with both. I also have tried using both User Configuration and Computer Configuration, with the same settings as above. The other thing that I have changed, is the 'Start in' setting, which I have set to C:\ and C:\Windows to test, and still had the same issue.

On the endpoints, I run gpresult and see the policy has applied successfully, but there is no task. I turned on the logging and tracing option in group policy and saw this in the resulting file:

2022-05-03 10:49:26.732 [pid=0x604c,tid=0x54ec] Entering ProcessGroupPolicyExSchedTasks()
2022-05-03 10:49:26.734 [pid=0x604c,tid=0x54ec] SOFTWARE\Policies\Microsoft\Windows\Group Policy\{AADCED64-746C-4633-A97C-D61349046527}
2022-05-03 10:49:26.734 [pid=0x604c,tid=0x54ec] BackgroundPriorityLevel ( 7 )
2022-05-03 10:49:26.734 [pid=0x604c,tid=0x54ec] DisableRSoP ( 0 )
2022-05-03 10:49:26.734 [pid=0x604c,tid=0x54ec] LogLevel ( 2 )
2022-05-03 10:49:26.734 [pid=0x604c,tid=0x54ec] Command subsystem initialized. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:26.814 [pid=0x604c,tid=0x54ec] ----- Parameters
2022-05-03 10:49:26.814 [pid=0x604c,tid=0x54ec] CSE GUID : {AADCED64-746C-4633-A97C-D61349046527}
2022-05-03 10:49:26.814 [pid=0x604c,tid=0x54ec] Flags : ( X ) GPO_INFO_FLAG_MACHINE - Apply machine policy rather than user policy
2022-05-03 10:49:26.814 [pid=0x604c,tid=0x54ec]         ( X ) GPO_INFO_FLAG_BACKGROUND - Background refresh of policy (ok to do slow stuff)
2022-05-03 10:49:26.814 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_SLOWLINK - Policy is being applied across a slow link
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_VERBOSE - Verbose output to the eventlog
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_NOCHANGES - No changes were detected to the Group Policy Objects
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_LINKTRANSITION - A change in link speed was detected between previous policy application and current policy application
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_LOGRSOP_TRANSITION - A change in RSoP logging was detected between the application of the previous policy and the application of the current policy.
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         ( X ) GPO_INFO_FLAG_FORCED_REFRESH - Forced Refresh is being applied. redo policies.
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_SAFEMODE_BOOT - windows safe mode boot flag
2022-05-03 10:49:26.815 [pid=0x604c,tid=0x54ec]         (   ) GPO_INFO_FLAG_ASYNC_FOREGROUND - Asynchronous foreground refresh of policy
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] Token (computer or user SID): S-1-5-18
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] Abort Flag : Yes (0xa3c28330)
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] HKey Root : Yes (0x80000002)
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] Deleted GPO List : No
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] Changed GPO List : Yes
2022-05-03 10:49:26.816 [pid=0x604c,tid=0x54ec] Asynchronous Processing : Yes
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] Status Callback : No (0x00000000)
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] WMI namespace : Yes (0xa3cb7380)
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] RSoP Status : Yes (0x61e7e970)
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] Planning Mode Site : (none)
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] Computer Target : No (0x00000000)
2022-05-03 10:49:26.817 [pid=0x604c,tid=0x54ec] User Target : No (0x00000000)
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec] Calculated list relevance. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec] ----- Changed - 0
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec] Options : (   ) GPO_FLAG_DISABLE - This GPO is disabled.
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec]           (   ) GPO_FLAG_FORCE - Do not override the settings in this GPO with settings in a subsequent GPO.
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec] Options (raw) : 0x00000000
2022-05-03 10:49:26.818 [pid=0x604c,tid=0x54ec] Version : 524296 (0x00080008)
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec] GPC : LDAP://CN=Machine,cn={8CD56729-C9ED-4281-91B7-E2ADADE058B3},cn=policies,cn=system,DC=ad,DC=domain,DC=com
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec] GPT : \\ad.domain.com\SysVol\ad.domain.com\Policies\{8CD56729-C9ED-4281-91B7-E2ADADE058B3}\Machine
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec] GPO Display Name : Office 365 Update / Install Task
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec] GPO Name : {8CD56729-C9ED-4281-91B7-E2ADADE058B3}
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec] GPO Link : (   ) GPLinkUnknown - No link information is available.
2022-05-03 10:49:26.819 [pid=0x604c,tid=0x54ec]            (   ) GPLinkMachine - The GPO is linked to a computer (local or remote).
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec]            (   ) GPLinkSite - The GPO is linked to a site.
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec]            ( X ) GPLinkDomain - The GPO is linked to a domain.
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec]            (   ) GPLinkOrganizationalUnit - The GPO is linked to an organizational unit.
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec]            (   ) GP Link Error
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec] lParam : 0x00000000
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec] Prev GPO : No
2022-05-03 10:49:26.820 [pid=0x604c,tid=0x54ec] Next GPO : Yes
2022-05-03 10:49:26.821 [pid=0x604c,tid=0x54ec] Extensions : [{00000000-0000-0000-0000-000000000000}{CAB54552-DEEA-4691-817E-ED4A4D1AFC72}][{AADCED64-746C-4633-A97C-D61349046527}{CAB54552-DEEA-4691-817E-ED4A4D1AFC72}]
2022-05-03 10:49:26.821 [pid=0x604c,tid=0x54ec] lParam2 : 0xa4a03778
2022-05-03 10:49:26.821 [pid=0x604c,tid=0x54ec] Link : LDAP://DC=ad,DC=domain,DC=com
2022-05-03 10:49:26.821 [pid=0x604c,tid=0x54ec] Completed get GPH path. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:26.822 [pid=0x604c,tid=0x54ec] Completed remove GPH. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:26.917 [pid=0x604c,tid=0x54ec] Read GPE XML data file (953 bytes total).
2022-05-03 10:49:26.917 [pid=0x604c,tid=0x54ec] Starting filter [AND NOT FilterOrgUnit].
2022-05-03 10:49:26.917 [pid=0x604c,tid=0x54ec] Properties handled. [ hr = 0x80070057 "The parameter is incorrect." ]
2022-05-03 10:49:26.918 [pid=0x604c,tid=0x54ec] There was a failure so the run once filter was rolled back. [ hr = 0x80070057 "The parameter is incorrect." ]
2022-05-03 10:49:26.918 [pid=0x604c,tid=0x54ec] Error suppressed. [ hr = 0x80070057 "The parameter is incorrect." ]
2022-05-03 10:49:26.918 [pid=0x604c,tid=0x54ec] ----- Changed - 1
2022-05-03 10:49:26.918 [pid=0x604c,tid=0x54ec] Options : (   ) GPO_FLAG_DISABLE - This GPO is disabled.
2022-05-03 10:49:26.918 [pid=0x604c,tid=0x54ec]           (   ) GPO_FLAG_FORCE - Do not override the settings in this GPO with settings in a subsequent GPO.
2022-05-03 10:49:26.919 [pid=0x604c,tid=0x54ec] Options (raw) : 0x00000000
2022-05-03 10:49:26.919 [pid=0x604c,tid=0x54ec] Version : 1966110 (0x001e001e)
2022-05-03 10:49:26.919 [pid=0x604c,tid=0x54ec] GPC : LDAP://CN=Machine,cn={7427C20A-C7B7-4E72-8CFA-C08AD7F69FDE},cn=policies,cn=system,DC=ad,DC=domain,DC=com
2022-05-03 10:49:26.919 [pid=0x604c,tid=0x54ec] GPT : \\ad.domain.com\SysVol\ad.domain.com\Policies\{7427C20A-C7B7-4E72-8CFA-C08AD7F69FDE}\Machine
2022-05-03 10:49:26.919 [pid=0x604c,tid=0x54ec] GPO Display Name : AutoDesk Deployment Task
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec] GPO Name : {7427C20A-C7B7-4E72-8CFA-C08AD7F69FDE}
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec] GPO Link : (   ) GPLinkUnknown - No link information is available.
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec]            (   ) GPLinkMachine - The GPO is linked to a computer (local or remote).
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec]            (   ) GPLinkSite - The GPO is linked to a site.
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec]            ( X ) GPLinkDomain - The GPO is linked to a domain.
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec]            (   ) GPLinkOrganizationalUnit - The GPO is linked to an organizational unit.
2022-05-03 10:49:26.920 [pid=0x604c,tid=0x54ec]            (   ) GP Link Error
2022-05-03 10:49:26.921 [pid=0x604c,tid=0x54ec] lParam : 0x00000000
2022-05-03 10:49:26.921 [pid=0x604c,tid=0x54ec] Prev GPO : Yes
2022-05-03 10:49:26.921 [pid=0x604c,tid=0x54ec] Next GPO : No
2022-05-03 10:49:26.922 [pid=0x604c,tid=0x54ec] Extensions : [{00000000-0000-0000-0000-000000000000}{CAB54552-DEEA-4691-817E-ED4A4D1AFC72}][{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F72-3407-48AE-BA88-E8213C6761F1}][{AADCED64-746C-4633-A97C-D61349046527}{CAB54552-DEEA-4691-817E-ED4A4D1AFC72}]
2022-05-03 10:49:26.922 [pid=0x604c,tid=0x54ec] lParam2 : 0xa4c7d008
2022-05-03 10:49:26.922 [pid=0x604c,tid=0x54ec] Link : LDAP://DC=ad,DC=domain,DC=com
2022-05-03 10:49:26.922 [pid=0x604c,tid=0x54ec] Completed get GPH path. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:26.923 [pid=0x604c,tid=0x54ec] Completed remove GPH. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.032 [pid=0x604c,tid=0x54ec] Read GPE XML data file (1002 bytes total).
2022-05-03 10:49:27.033 [pid=0x604c,tid=0x54ec] Starting filter [AND FilterGroup].
2022-05-03 10:49:27.034 [pid=0x604c,tid=0x54ec] Preliminary filter processing (status may be adjusted). [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.034 [pid=0x604c,tid=0x54ec] A filter failed to pass so the run once filter was rolled back. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.034 [pid=0x604c,tid=0x54ec] Completed get next GPO. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.035 [pid=0x604c,tid=0x54ec] Logging 0 new RSoP entries.
2022-05-03 10:49:27.035 [pid=0x604c,tid=0x54ec] Completed get GPO list. [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.035 [pid=0x604c,tid=0x54ec] IsRsopPlanningMode() [SUCCEEDED(S_FALSE)]
2022-05-03 10:49:27.292 [pid=0x604c,tid=0x54ec] Leaving ProcessGroupPolicyExSchedTasks() returned 0x00000000

The DC is Server 2019 and the endpoints are all Windows 10.

Any ideas on why this is happening?

Swisstone avatar
cn flag
Can you try to create the scheduled task by choosing "New -> Scheduled task (At least Windows 7)" option? Based on your screenshot you selected "New -> Scheduled task" and this is for older Windows versions.
Score:0
lv flag

Swisstone provided the right approach in his/her comment to the question:

At first I ran into exactly the same issue.

But after I created the task as a "Scheduled Task (At least Windows 7)" the task appeared on the target machine (and ran successfully)!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.