Archive: Adding tasks to windows Task Scheduler


Adding tasks to windows Task Scheduler
Hello all,

is there a way to add a task to the windows "Scheduled Tasks" via NSIS?

regards

Timo


Search for Scheduled Tasks
http://forums.winamp.com/showthread....scheduled+task

-Stu


I've created a Wiki page as this questions comes up once in a while. Feel free to beef it up.


Uninstall a scheduled task
Thank you for providing the plugin for scheduled tasks. One question I had was what would you need to add to the uninstall portion of the script to remove the scheduled task.

Thanks!


Instead of calling NewWorkItem with the task name, call Delete with the task name. The function ordinal of Delete is 7.


Run Only if Logged On Flag
On the wiki page it provides information for placing a username / password for the account running the scheduled task. Many of the systems that I wish to install on do not have a password associated with the account, which causes issues in the implementation.

The only workaround is to check the "Run Only if Logged On" flag within the scheduled task window. Can you provide the snippit that would check this flag similar to

; ITask->SetAccountInformation
System::Call '$R2->30(w r7, w r8)'

Thank you.


Are you sure it's possible to run tasks for users with no password? According to MSDN, NULL is only allowed for the local system account and, as you said, when using TASK_FLAG_RUN_ONLY_IF_LOGGED_ON. It says nothing on empty passwords, so if those don't work, they might simply not be supported.


Thanks for your response.

The scenario that you provide is correct. In essence I'd like to understand how to check the flag TASK_FLAG_RUN_ONLY_IF_LOGGED_ON and install under the local system account with null password. I've gone so far as to download c++ and the Platform SDK as the wiki suggests when using system calls, but I'm at a loss on how to identify the index for the TASK_FLAG_RUN_ONLY_IF_LOGGED_ON.

I appreciate your help,

Clark


It's defined in MSTask.h. TASK_FLAG_RUN_ONLY_IF_LOGGED_ON is 0x2000.


To check the Run Only if Logged On box
Following is the additional lines I added to my CreateTask function to check the Run Only if Logged On box.

; ITask->SetFlags()
System::Call '$R2->28(i 0x2000)'

I'd like to thank kichik for all his help!