2

On Windows machines, schtasks is a utility similar to cron for scheduling jobs to run on a regular basis.

Problem is, when you define a schtask, you must specify the userid and password of the account to run the job.

Then later, when the user changes his password, that schtask will no longer work. It must be deleted and rescheduled with the new password.

So, how can I setup a scheduled job (via schtasks, at, whatever) that's immune to password changes?

robmandu
  • 193
  • 1
  • 2
  • 11

3 Answers3

3

This doesn't quite answer your question, but a common workaround is to create a user (with appropriate privileges) and use that account solely for executing scheduled tasks.

As the user account is created with a non-expiring password, the sysadmin who creates it should choose an appropriately strong password.

teedyay
  • 23,293
  • 19
  • 66
  • 73
  • Hah, just when I wanted to click "Post your answer"...beat me to it ;-) +1 – RuudKok Mar 10 '09 at 15:32
  • In a production environment this is general the best practice as well. Regular user accounts can have their permissions changed or revoke, or can be removed or disabled entirely. A service account is much easier to manage, as well as limit the scope of. – David Mar 10 '09 at 15:38
1

Just add this to your command:

/RU "NT AUTHORITY\SYSTEM" /RP *

Will run as System and ignore passwords.

Jhollman
  • 2,093
  • 24
  • 19
0

There is also a way to update existing tasks. In cmd prompt you would use the following to help you:

schtasks /change /tn TaskName [/s computer [/u [domain\]user /p password]] [/tr TaskRun] [/ru [Domain\]User | "System"] [/rp Password]

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true

David Starkey
  • 1,840
  • 3
  • 32
  • 48