The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #14749

puppet resource scheduled_task creates the task, but generates an error

Added by Josh Cooper almost 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:05/30/2012
Priority:NormalDue date:
Assignee:Josh Cooper% Done:


Target version:2.7.19
Affected Puppet version:2.7.8 Branch:
Keywords:windows scheduled_task

We've Moved!

Ticket tracking is now hosted in JIRA:


Executing the following creates the task, but generates an exception:

C:\work\puppet>envpuppet puppet resource --debug --trace --verbose scheduled_task pl107124 ensure=present command=c:/windows/system32/notepad.exe
debug: Loaded state in 0.00 seconds
notice: /Scheduled_task[pl107124]/ensure: created
debug: Finishing transaction 131594112
debug: Storing state
debug: Stored state in 0.02 seconds
c:/puppetwinbuilder/sys/ruby/lib/ruby/gems/1.8/gems/win32-taskscheduler-0.2.2/lib/win32/taskscheduler.rb:1297:in `flags'
: null pointer (Win32::TaskScheduler::Error)
        from c:/work/puppet/ext/../lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:49:in `enabled'
        from c:/work/puppet/ext/../lib/puppet/property.rb:277:in `send'
        from c:/work/puppet/ext/../lib/puppet/property.rb:277:in `retrieve'
        from c:/work/puppet/ext/../lib/puppet/type.rb:720:in `retrieve'
        from c:/work/puppet/ext/../lib/puppet/type.rb:715:in `each'
        from c:/work/puppet/ext/../lib/puppet/type.rb:715:in `retrieve'
        from c:/work/puppet/ext/../lib/puppet/type.rb:728:in `retrieve_resource'
        from c:/work/puppet/ext/../lib/puppet/type.rb:1930:in `to_trans'
        from c:/work/puppet/ext/../lib/puppet/type.rb:1955:in `to_resource'
        from c:/work/puppet/ext/../lib/puppet/indirector/resource/ral.rb:32:in `save'
        from c:/work/puppet/ext/../lib/puppet/indirector/indirection.rb:272:in `save'
        from c:/work/puppet/ext/../lib/puppet/application/resource.rb:227:in `find_or_save_resources'
        from c:/work/puppet/ext/../lib/puppet/application/resource.rb:144:in `main'
        from c:/work/puppet/ext/../lib/puppet/application.rb:317:in `run_command'
        from c:/work/puppet/ext/../lib/puppet/application.rb:309:in `run'
        from c:/work/puppet/ext/../lib/puppet/application.rb:416:in `hook'
        from c:/work/puppet/ext/../lib/puppet/application.rb:309:in `run'
        from c:/work/puppet/ext/../lib/puppet/application.rb:407:in `exit_on_fail'
        from c:/work/puppet/ext/../lib/puppet/application.rb:309:in `run'
        from c:/work/puppet/ext/../lib/puppet/util/command_line.rb:69:in `execute'
        from c:/work/puppet/ext/../bin/puppet:4

The issue is that when the provider’s flush method is called, it saves the task, which releases (in the COM sense) the handle to the @pITask. Then puppet resource retrieves the resource it just saved, and it reuses the invalid task object.


#1 Updated by Josh Cooper almost 4 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Affected Puppet version set to 2.7.8
  • Branch set to

#2 Updated by Patrick Carlisle almost 4 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Target version changed from 2.7.x to 2.7.18

#3 Updated by Josh Cooper almost 4 years ago

  • Target version changed from 2.7.18 to 2.7.19

#4 Updated by Moses Mendoza almost 4 years ago

  • Status changed from Merged - Pending Release to Closed

Released in 2.7.19rc1.

#5 Updated by Matthaus Owens over 3 years ago

Released in Puppet 3.0.0-rc4

Also available in: Atom PDF