View Full Version : Adding tasks to windows Task Scheduler
8th September 2005, 12:29
is there a way to add a task to the windows "Scheduled Tasks" via NSIS?
8th September 2005, 13:07
Search for Scheduled Tasks
8th September 2005, 17:38
I've created a Wiki page (http://nsis.sourceforge.net/wiki/Scheduled_Tasks) as this questions comes up once in a while. Feel free to beef it up.
3rd January 2007, 22:35
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.
4th January 2007, 20:11
Instead of calling NewWorkItem with the task name, call Delete with the task name. The function ordinal of Delete is 7.
6th February 2007, 23:55
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
System::Call '$R2->30(w r7, w r8)'
9th February 2007, 12:06
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.
9th February 2007, 12:38
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,
9th February 2007, 13:04
It's defined in MSTask.h. TASK_FLAG_RUN_ONLY_IF_LOGGED_ON is 0x2000.
13th February 2007, 13:12
Following is the additional lines I added to my CreateTask function to check the Run Only if Logged On box.
System::Call '$R2->28(i 0x2000)'
I'd like to thank kichik for all his help!
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.