Cannot create a scheduled task with group policy preferences

I am attempting to create a scheduled task to run on both Vista and 7 systems. The task simply runs an executable on both login and unlock of a computer if the user is a member of a certain OU. For troubleshooting purposes I've created a new GPO containing only this setting. The task is not being created, while all other settings are applied. When I run GPResults on a Vista machine, I can see all of the settings, and under scheduled tasks I get the following error:

An error has occurred while collecting data for Scheduled Tasks.
The following errors were encountered:
An unknown error occurred while data was gathered for this extension. Details: Invalid class

I've enabled GPMC logging and see the following error in gpmgmtManaged.log:
Reporting(5124.4)12:59:48 ScheduledTasksTemplate::SetExtensionData:PolicyMaker extensions error

It may be a separate issue, but when I run GPResults on a 7 machine, both the summary and settings column show the following:
An error occurred while generating report:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

The logs aren't giving me much to go on, really. Does anyone have any other ideas to try?


The server is 2003 R2 and it passes all of the dcdiag tests.

Thanks!

September 15th, 2010 5:14pm

I'm not 100% sure if your issue relates to this one, but when i read "Task" and "Preference" i just remember having seen the following hotfix.

A Group Policy Immediate Task preference item does not run on a client computer that is running Windows 7 or Windows Server 2008 R2

http://support.microsoft.com/kb/977353/en-us

 

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2010 7:26pm

I have seen that article in my troubleshooting attempts. I don't believe it is the issue, however. Quite a few of the machines I'm trying this on are Vista. The article also is talking about Immediate tasks that are applied to the computer but not running. I don't even see the scheduled tasks being created. Thanks for the suggestion, though!
September 15th, 2010 7:42pm

Just bumping this up to see if anyone has any ideas. I happened to be looking in my logs for another issue and saw the following in the Setup log of my own Windows 7 computer:

The user 'Authenticat' preference item in the 'Authenticat {57BB25C9-F6B1-41E1-852A-1BAB86DC231A}' Group Policy object did not apply because it failed with error code '0x80041316 The task XML contains an unexpected node.' This error was suppressed.

I found another thread with a similar problem here: http://social.technet.microsoft.com/Forums/en-US/winserverGP/thread/8b6d24cf-8d17-4a80-8111-5b5ed13e4073
As requested there, I've posted the xml file for the scheduled task preference here: http://cid-6b9b2b0102931c49.office.live.com/embedicon.aspx/.Public/ScheduledTasks.xml

Does anyone have any other suggestions?

Free Windows Admin Tool Kit Click here and download it now
October 1st, 2010 12:58pm

I spent some more time troubleshooting this today and narrowed it down to a particular setting.

I am specifying a couple triggers for this task. When creating the trigger I am choosing the radio to select "Specific User or Group" and then specifying a security group. If I use that option to specify just a particular user, I don't get the unexpected node error and the task is created. So it seems to be something with using a group to apply the trigger.

Has anyone out there seen anything similar?

October 15th, 2010 6:55pm

Once again just checking if anyone else can reproduce or sees anything similar.

Thanks!

Free Windows Admin Tool Kit Click here and download it now
October 19th, 2010 1:45pm

Feel like I'm talking to myself here, but I'm hoping someone may eventually see this and be able to provide some insight. In attempting to figure out some way around this I am messing with schtasks in the command line. I also tried manually creating the task on a client machine with the same triggers. When I try to manually create the triggers, the same box that asks me for "Specific user or Group" in the group policy editor only asks for "Specific User" on the client machine.

I exported the xml of my manually created scheduled task, replaced the instances of <UserID> with <GroupID> as is shown the the xml for the group policy created task. When I try to create a new task based off this edited xml using schtask /create /tn TaskName /xml xmlfile.xml, I get the same error - "The task xml contains an unexepected node."

So I guess the question is if scheduled task triggers actually support groups, as the only place I am given that option is in the group policy editor.

October 22nd, 2010 5:50pm

I'm having the same problem... I had a feeling it might be the group but I'll try and confirm that. Mine was working and actually running the task for about 2 months then stopped working all of the sudden with that same error.
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 9:13pm

I'd love to hear if you can confirm the group issue. For the time being I've given up trying to use GPP and am using a login script to add the scheduled task. The scheduled task runs at login and unlock, firing a autoit script that checks group membership and runs or kills the process depending on the results.
November 12th, 2010 3:08pm

We had the same issue here and it appears it might have something to do with us setting the task to run in the SYSTEM context. We switched it to a local admin. account and it took the task without error. Waiting to see if the task works as we'd like for it to.
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2011 6:52pm

I am seeing the same problem.  I have tried with "builtin\users" and "%LogonDomain%\%LogonUser%" as who to run it as.  When I specify a specific user, it applies the Scheduled Task, but I need it to run as the current logged in user.
June 1st, 2011 6:09pm

Hi schmidj,

Have you tried the use of %LogonUser% instead of %LogonDomain%\%LogonU

Free Windows Admin Tool Kit Click here and download it now
June 2nd, 2011 5:17am

I have found by exporting and examining the resulting XML that the GPO editor is in some cases adding an extra logonType element under Task/Principals/Principal in addition to the logonType attribute of the Properties node.  If I remove it and then import the XML the scheduled task appears on the clients and works.  I have been successful in using the Domain Users group in the GUI and then editing the XML to remove the extra logonType and change the RunAs and GroupID to BUILTIN\Users (just Users appears to work only on 7/R2).  Perhaps this has been addressed either on purpose or inadvertently in one of the hotfixes I am about to install.

January 15th, 2012 11:47am

Same problem, when creating scheduled tasks from an GPO. The scheduled task is being created in de machine policy an has to run under the local SYSTEM account. Editing the xml file solved the problem.

i made two changes

1. removed the Task/Principals/Principal/logonType attribute

2. Set runAs and GroupID to SYSTEM.

See the modified XML below......

<?xml version="1.0" encoding="utf-8"?>
<ScheduledTasks clsid="{CC63F200-7309-4ba0-B154-A71CD118DBCC}">
 <TaskV2 clsid="{D8896631-B747-47a7-84A6-C155337F3BC8}" name="GPO Weekly defragmentation" image="2" changed="2012-11-09 13:32:18" uid="{8CF287F1-D02C-4BFF-B86C-FB9519B9B1D2}" userContext="0" removePolicy="0">
  <Properties action="U" name="GPO Weekly defragmentation" runAs="SYSTEM" logonType="Group">
   <Task version="1.2">
    <RegistrationInfo>
     <Author>domain\Admin</Author>
     <Description></Description>
    </RegistrationInfo>
    <Principals>
     <Principal id="Author">
      <RunLevel>LeastPrivilege</RunLevel>
      <GroupId>SYSTEM</GroupId></Principal>
    </Principals>
    <Settings>
     <IdleSettings>
      <Duration>PT10M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
     </IdleSettings>
     <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
     <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
     <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
     <AllowHardTerminate>true</AllowHardTerminate>
     <AllowStartOnDemand>true</AllowStartOnDemand>
     <Enabled>true</Enabled>
     <Hidden>false</Hidden>
     <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
     <Priority>7</Priority>
    </Settings>
    <Actions>
     <Exec>
      <Command>%WINDIR%\system32\defrag.exe</Command>
      <Arguments>-C</Arguments>
     </Exec>
    </Actions>
    <Triggers><CalendarTrigger><StartBoundary>2012-11-09T23:00:00</StartBoundary><Enabled>true</Enabled><ScheduleByWeek><WeeksInterval>1</WeeksInterval><DaysOfWeek><Saturday/></DaysOfWeek></ScheduleByWeek><ExecutionTimeLimit>PT1H</ExecutionTimeLimit></CalendarTrigger>
    </Triggers></Task>
  </Properties>
 </TaskV2>
</ScheduledTasks>


Free Windows Admin Tool Kit Click here and download it now
November 9th, 2012 1:41pm

Thanks guys.

  • Proposed as answer by Searce 7 hours 53 minutes ago
  • Unproposed as answer by Searce 7 hours 53 minutes ago
April 11th, 2013 7:09pm

I changed  the user account to %LogonUser% and also run only when user is logged on and it works. thxs.
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2015 7:14pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics