Archive: Scheduled tasks


Scheduled tasks
Hello,

I am trying to setup scheduled tasks and properly set the user /password that I get through a custom page. I use a script that I got somewhere (can't remember exactly but probably here) that uses ITaskScheduler and ITask. I therefore does something like:

System::Call '$R2->30(w "user", w "password")'

but it does not seem to work. Does anyone has any success with this?

Thanks,
mynab


Please search the forum in future...
http://forums.winamp.com/showthread....highlight=task

-Stu


Please read the messages in the future...
The thread you mention is the one I got the script from. I am trying to enhance this script to add a call to ITask to set the user and password on the task I create. Anyone?

-Mynab


Sorry but your original post did not contain information about the direct source.

Try t instead of w

-Stu


According to MSDN, SetAccountInformation requires Unicode string, so w is ok.

What's the return value of the method?


Not sure if it's right but what I did is add i.R9 at the end of my System::Call line and then do a MessageBox with $R9 and it displays 0 which is equal to S_OK. So it seems Windows does not complain.

However if I then go to the scheduled tasks panel and run my task it fails. If I open the task set the password and then run it again it is OK so I guess I really have to set the password on the task even though the task should be run by the same user as the one that installs the software (Administrator in that case).

mynab


Anyone on this?

mynab


Can you post the complete code snippet so it can be tested?


Sorry kichik,

did not see your post and switched to something else. Just tought I should give an update on this.

I finally discovered and started to use the schtasks command. Much more powerful than the at command as it allows for everything I needed except multiple scheduling for the same task. It might not be available on older systems but it is at least on XP Pro and 2003 Server. Just type schtasks /? at the command prompt to get a detailed explanation of all the command line switches.

Regards,
mynab