组策略计划任务用于运行 .bat 文件,但未创建任务

组策略计划任务用于运行 .bat 文件,但未创建任务

我正在尝试添加计划任务以运行更新/安装软件的批处理文件。我创建了一个 GPO 来创建任务,使用以下设置:

任务设置

任务设置2

任务设置3

对于其中一个,我使用项目级别定位仅应用于一个组。但这两个都发生了这个问题。我也尝试使用用户配置和计算机配置,使用与上述相同的设置。我更改的另一件事是“开始于”设置,我将其设置为 C:\ 和 C:\Windows 进行测试,但仍然有同样的问题。

在端点上,我运行 gpresult 并看到策略已成功应用,但没有任务。我在组策略中打开了日志记录和跟踪选项,并在结果文件中看到了以下内容:

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

DC 是 Server 2019,端点都是 Windows 10。

对于为什么会发生这种情况有什么想法吗?

答案1

Swisstone 在其对该问题的评论中提供了正确的方法:

起初我遇到了完全相同的问题。

但是,在我将任务创建为“计划任务(至少是 Windows 7)”后,该任务出现在目标机器上(并成功运行)!

相关内容