4

OK, I have a Windows 2008 Server scheduled task that runs on system startup. This works fine. But I want to move this task to another box (actually, I'm using Amazon and need this to work on other instances launched from this image but that's complexity not relevant to the problem).

So I export the task to XML, and try to import it using schtasks. But when I try to reimport it on the same box (just by changing the name), I get

C:\>schtasks /Create /XML "mytask.xml" /TN "My Task 2"

ERROR: No mapping between account names and security IDs was done.
(17,8):LogonType:

I look, and I notice that in the Principals section it says

 <UserId>IP-0AD68720\Administrator</UserId>

Which will make me sad when I try to move this task to another box. But if I edit that to just say "Administrator", when I import I get this error:

ERROR: Logon failure: unknown user name or bad password.

So I can't even reimport it on the same box, and can clearly see I'll have trouble importing it on another... Any hints? I want to alter the task so I can use it on other boxes to accomplish the same goal.

Thanks...

quanta
  • 51,413
  • 19
  • 159
  • 217
Ernest Mueller
  • 1,199
  • 2
  • 12
  • 25
  • so you've scheduled a task to run as administrator, why not local system? – tony roth Jul 01 '10 at 19:43
  • Slight confusion - are you trying to copy the task on the same instance, or copy it to import elsewhere? Also, when you say "just by changing the name" are you changing the filename of the XML? Also, just to confirm, it sounds like these are standalone, not part of a domain? – Kara Marfia Jul 01 '10 at 19:44
  • Kara - I am trying both. It won't reimport on the same box as is. I save the .xml, then schtasks create with it using a different task name ("My Task 2" instead of "My Task") and get that mapping error. Then, in addition with an eye to box portability, I change the username and try to import it and get that unknown user error. And by changing the name, no, I mean I am changing the user name within the XML from IP-xxx\Administrator to Administrator (I've also tried SYSTEM\Administrator). – Ernest Mueller Jul 01 '10 at 19:59
  • 1
    ok in order to make this transportable, where the scheduler asks for a username and pw just enter system for the username and no password. – tony roth Jul 01 '10 at 20:02
  • Ah, I see. And the XML that is generated changes to have userid SYSTEM and the auth line of password is gone. Looks like that works, thanks! (It imports now at least.) I'd mark your answer good but it's a comment not an answer :-( – Ernest Mueller Jul 01 '10 at 20:15

1 Answers1

5

ok in order to make this transportable, where the scheduler asks for a username and pw just enter system for the username and no password.

tony roth
  • 3,884
  • 18
  • 14
  • This might help : https://stackoverflow.com/questions/71824185/how-to-setup-scheduler-task-cron-in-windows-server-via-ebextensions-config/71827283#71827283 – Mihir Bhatt Apr 11 '22 at 11:48