Thursday, February 24, 2011

Scheduled task error 0x8007000d

Each time I deploy Windows 2003 from an image and I run sysprep, the existing scheduled tasks fail and I get the following error when trying to access each task property:

---------------------------
Task Scheduler
---------------------------
General page initialization failed.
The specific error is:
“0x8007000d: The data is invalid. An error has occurred
attempting to retrieve task account information.
You may continue editing the task object, but will be
unable to change task account information.

When I press OK, I notice that the Run As line is left blank and that the Run line is dimmed. As this is a recurring situation still today, I have decided to share the solution I have found for future use.
There are three steps to follow:
  • Stop the Task Scheduler Service: net stop "Task Scheduler"
  • Delete the file whose name begins with d42* inside C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\S-1-5-18
  • Start the Task Scheduler service: net start "Task Scheduler"
The explaination to this is that the file named d42cc0c3858..., which contains the saved RSA key, refers to a domain account which has become invalid after sysprepping the system. This behavior occurs because sysprep changes the security identifiers (SIDs) for the local machine and user accounts. After the System Preparation tool alters the SIDs, the old encryption keys cannot work anymore. This is also true if you clone a mirrored disk to a new server and then run newsid.exe to make the new server installation unique.

The folder C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\S-1-5-18\ is the place where the Microsoft legacy CryptoAPI CSPs store private keys for S-1-5-18, which is the textual SID for the local system account.

So, once I delete that file named d42cc0c3858..., I also delete all of my invalid scheduled tasks (del c:\windows\tasks\*) then I recreate them. The best method I have found to create the tasks via the command line is to use schtasks.exe.

For instance, to create a task that runs every 10 minutes every day, just run:

schtasks /create /s \\cloned_srv_1 /u your_domain\your_account /p your_password /ru task_username /rp task_password /sc minute /mo 10 /tn task_name /tr task_command_line

The complete syntax for schtasks.exe can be found here.
I hope this helps!

12 comments:

  1. Many thanks, this saved my day... :-)

    ReplyDelete
  2. Thank you! Fixed my scheduled tasks after I demoted the a domain controller to a member server.

    ReplyDelete
  3. Thanks for this. Like Ben, I too demoted an old 2000 server to raise the functional level of our forest/domain and some tasks started bombing.

    ReplyDelete
  4. Thanks . This sorted my problem out.

    ReplyDelete
  5. Thanks a lot. Explained a lot to me.

    ReplyDelete
  6. Many thank you! Have'd a big problem after renaming all our domain users, all new tasks created by GPP, created with old accounts!. After deleting D42* problem was solved.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...