Forum Home
Press F1
 
Thread ID: 62991 2005-10-25 22:29:00 Creating Scheduled Tasks Remotely arven (9139) Press F1
Post ID Timestamp Content User
399346 2005-10-25 22:29:00 Hello,

I am trying to roll out some basic scheduled tasks to our domain of Windows 2000 and XP Computers.

I want to be able to put a string into the user's login script (or create an Altiris job to roll them out) that will setup a scheduled task and run every night for basic things like Disk Cleanup and Defrag etc.. I have setup a Disk Cleanup with a template of the things I want cleaned out, and exported the registry file for those settings. That’s all working fine on my PC etc. But when I try to write the command line to create the scheduled task I run into problems. This is what I have so far:

schtasks /create /tn "Daily Disk Cleanup" /tr "cleanmgr.exe /sagerun:13" /ru administrator /rp password /sc daily /st 15:30:00

So this is supposed to create a task called "Daily Disk Cleanup" that runs "Cleanmgr.exe with my set template (called 13) running as the local administrator with the local password every day at 3.30pm... Of course before I run this I have merged the Reg Key of the sagerun template

I have tried MANY different combinations with help from Microsoft’s website below with no luck:

www.microsoft.com

Could someone please help me out here? I have spent too long on something that should be EASY! Or maybe I'm just stupid...

Cheers,


Mike.
arven (9139)
399347 2005-10-25 23:16:00 Are there any error messages? gibler (49)
399348 2005-10-26 00:46:00 AHH sorry guys, i got it working with the above script only i cant use Disk Cleanup without providing the currently logged on user's password . Because i'm running it as the local administrator, its only clearing out the local admins Temp files etc . . .

I will just write a BAT file to clear out whatever files i need . . .

Ohh and the above command only works on XP! (the schtasks command) Now i have to figure out how to do it for 2k! Any ideas?? :)
arven (9139)
399349 2005-10-27 09:25:00 Doesn't it just create a .job file? I think it might include the credentials in the file or else you have to add them using a text editor, but it can definately be done. You could just copy the .job file into the appropriate location and viola. BIFF (1)
1