Exporting / Altering scheduled tasks

B

Benny

Hi All

I have a client who has about 2000 jobs running nightly reports in Schedules
Tasks on Win2000 Pro. He needs to move them to his new win2003 server. But
when he moves them (via copy/paste) each job need various things amending
before it will run. ie, user/password credentials, file paths, etc
Obviously he does not want to have to edit each of the 2000 jobs, so does
any one know if there is a tool out there to automate changes to multiple
schedule tasks like this? Or alternatively does any one know of any 3rd
party scheduling tools that may be easier to do these sort of things ?

Any suggestions much appreciated.

Ben
 
P

Pegasus \(MVP\)

Benny said:
Hi All

I have a client who has about 2000 jobs running nightly reports in Schedules
Tasks on Win2000 Pro. He needs to move them to his new win2003 server. But
when he moves them (via copy/paste) each job need various things amending
before it will run. ie, user/password credentials, file paths, etc
Obviously he does not want to have to edit each of the 2000 jobs, so does
any one know if there is a tool out there to automate changes to multiple
schedule tasks like this? Or alternatively does any one know of any 3rd
party scheduling tools that may be easier to do these sort of things ?

Any suggestions much appreciated.

Ben

The only thing you need to re-enter is the user/password. You
cannot automate this process.
 
D

Dave Patrick

One idea might be to run from the command line;
schtasks /query >D:\dave.txt
then import the text file into excel and loop through the 'TaskName' column
and run against each of the tasks

schtasks /change /ru <newuser> /rp <newpassword> /tn <taskname>

D:\>schtasks /change /?

SCHTASKS /Change [/S system [/U username [/P password]]] {[/RU runasuser]
[/RP runaspassword] [/TR taskrun]} /TN taskname

Description:
Changes the program to run, or user account and password used by a
scheduled task.

Parameter List:
/S system Specifies the remote system to connect to.

/U username Specifies the user context under which the
command should execute.

/P password Specifies the password for the given user
context.

/RU username Changes the user name (user context) under
which the scheduled task has to run.
For the system account, valid values are "",
"NT AUTHORITY\SYSTEM" or "SYSTEM".

/RP password Specifies a new password for the existing user
context or the password for a new user account. Password will not effect for
the system account.

/TR taskrun Specifies a new program that the scheduled
task runs. Type the path and file name of the program.

/TN taskname Specifies which scheduled task to change.

/? Displays this help/usage.

Examples:
SCHTASKS /Change /RP password /TN "Backup and Restore"
SCHTASKS /Change /TR restore.exe /TN "Start Restore"
SCHTASKS /Change /S system /U user /P password /RU newuser
/TN "Start Backup"


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect


:
| Hi All
|
| I have a client who has about 2000 jobs running nightly reports in
Schedules
| Tasks on Win2000 Pro. He needs to move them to his new win2003 server. But
| when he moves them (via copy/paste) each job need various things amending
| before it will run. ie, user/password credentials, file paths, etc
| Obviously he does not want to have to edit each of the 2000 jobs, so does
| any one know if there is a tool out there to automate changes to multiple
| schedule tasks like this? Or alternatively does any one know of any 3rd
| party scheduling tools that may be easier to do these sort of things ?
|
| Any suggestions much appreciated.
|
| Ben
|
|
 
T

tlviewer

Benny said:
Hi All

I have a client who has about 2000 jobs running nightly reports in Schedules
Tasks on Win2000 Pro. He needs to move them to his new win2003 server. But
when he moves them (via copy/paste) each job need various things amending
before it will run. ie, user/password credentials, file paths, etc
Obviously he does not want to have to edit each of the 2000 jobs, so does
any one know if there is a tool out there to automate changes to multiple
schedule tasks like this? Or alternatively does any one know of any 3rd
party scheduling tools that may be easier to do these sort of things ?

Any suggestions much appreciated.

Ben

Ben,

The suggestion given by Dave Patrick will work.
If you would like another approach that allows
you to enumerate through all the JOB files and
modify each in-process, see ...

http://groups.google.com/groups?q=script+mstask

I've used this object recently to modify
600 JOB files in one pass. The script ran in
less than 3 minutes. Interacting with the Run-As
credentials will be slow no matter what you do, but
with that object no prompts appeared.

good luck,
Mark
 
B

Benny

Hi Dave

Many Thanks for the advice. Looks like that will work a treat.

As you guys have done this kinda stuff before, you may know how to do this
.....

I also need to change the "Start in" parameter for each of 2000 or so
scheduled tasks.
I have tried copying and altering the *.job files but as soon as I change
the text in the file and save it disappears from scheduled tasks. so I guess
it makes it invalid or something.

Do you guys know a way of automating a change of this kind ?

Thanks in advance for any ideas.

Ben

Dave Patrick said:
One idea might be to run from the command line;
schtasks /query >D:\dave.txt
then import the text file into excel and loop through the 'TaskName' column
and run against each of the tasks

schtasks /change /ru <newuser> /rp <newpassword> /tn <taskname>

D:\>schtasks /change /?

SCHTASKS /Change [/S system [/U username [/P password]]] {[/RU runasuser]
[/RP runaspassword] [/TR taskrun]} /TN taskname

Description:
Changes the program to run, or user account and password used by a
scheduled task.

Parameter List:
/S system Specifies the remote system to connect to.

/U username Specifies the user context under which the
command should execute.

/P password Specifies the password for the given user
context.

/RU username Changes the user name (user context) under
which the scheduled task has to run.
For the system account, valid values are "",
"NT AUTHORITY\SYSTEM" or "SYSTEM".

/RP password Specifies a new password for the existing user
context or the password for a new user account. Password will not effect for
the system account.

/TR taskrun Specifies a new program that the scheduled
task runs. Type the path and file name of the program.

/TN taskname Specifies which scheduled task to change.

/? Displays this help/usage.

Examples:
SCHTASKS /Change /RP password /TN "Backup and Restore"
SCHTASKS /Change /TR restore.exe /TN "Start Restore"
SCHTASKS /Change /S system /U user /P password /RU newuser
/TN "Start Backup"


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect


:
| Hi All
|
| I have a client who has about 2000 jobs running nightly reports in
Schedules
| Tasks on Win2000 Pro. He needs to move them to his new win2003 server. But
| when he moves them (via copy/paste) each job need various things amending
| before it will run. ie, user/password credentials, file paths, etc
| Obviously he does not want to have to edit each of the 2000 jobs, so does
| any one know if there is a tool out there to automate changes to multiple
| schedule tasks like this? Or alternatively does any one know of any 3rd
| party scheduling tools that may be easier to do these sort of things ?
|
| Any suggestions much appreciated.
|
| Ben
|
|
 
D

Dave Patrick

Look like they haven't given us a way to do this. Actually I've never needed
to use/specify the "working directory" before.

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

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect


:
| Hi Dave
|
| Many Thanks for the advice. Looks like that will work a treat.
|
| As you guys have done this kinda stuff before, you may know how to do this
| ....
|
| I also need to change the "Start in" parameter for each of 2000 or so
| scheduled tasks.
| I have tried copying and altering the *.job files but as soon as I change
| the text in the file and save it disappears from scheduled tasks. so I
guess
| it makes it invalid or something.
|
| Do you guys know a way of automating a change of this kind ?
|
| Thanks in advance for any ideas.
|
| Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top