View Full Version : how to add scheduled task, or is it possible?
31st August 2003, 06:46
what if i wanted myapp.exe to be launched every monday at 09:00 ?
31st August 2003, 10:12
A little forum search came up with:
31st August 2003, 12:24
That would be a good plugin for NSIS.
Do you think it will be made?
31st August 2003, 12:26
Not by me on the near couple of weeks.
2nd September 2003, 11:14
At NT/W2k/Xp system there is command AT.EXE.
at.exe 9:00 /every:monday "c:\test.exe"
3rd September 2003, 12:06
Job could be done using updated system plugin (as soon as exehead will be updated too, for plugin look at "Exehead & Ole" thread). I've included source file with function and use example (since it will be hard to extract information from this page :)
push "My Task"
push "My Task Comment"
push "c:\Working Dir\My Task Program.exe"
push "c:\Working Dir"
push "My Program Args"
; what that's structure means? look thru attached nsi file, that's information tooks to many place
push "*(&l2, &i2 0, &i2 2003, &i2 9, &i2 3, &i2 0, &i2 0, &i2 0, &i2 9, &i2 0, i 0, i 0, i 0, i 2, &i2 1, &i2 0x2, &i2 0, i 0, &i2 0) i.s"
MessageBox MB_OK "CreateTask result: $0"
Realization and TIME_TRIGGER structure description are at attached nsi file.
4th September 2003, 15:01
well, i got first example working fine, but i didn't manage to do it with the other one :(
4th September 2003, 17:22
first example???? I've posted only one...
Oh. you mean at.exe. :)
To utilize second one (it will work at win95-winxp) you'll need the latest CVS (as soon as Kichik will update it for compatibility with system plugin ;).
So... All together: KICHIK! KICHIK!! KICHIK!!!
8th September 2003, 11:44
well i still didn't understand second example, but i have a question with the first one. By default this command line
'at.exe 9:00 /every:monday "c:\test.exe"'
gives a name for the scheduled task "at1". is it possible to give job different name?
8th September 2003, 11:49
For the second one you need the latest CVS version. As for the name of the task with the first one, if to believe to at.exe /?, you can't.
8th September 2003, 12:28
Somebody checked it beside me? Kichik could you please? ;)
8th September 2003, 12:57
Yes, it works.
8th September 2003, 16:39
ok got it:)
11th September 2003, 14:42
Just a system update.
release 5, 11 september 2003.
1. u flag - unload dll after procedure call.
2. some changes to asm to turn on Whole Program Optimization.
3. Dll shrinked for 1 kb.
11th September 2003, 20:21
23rd September 2010, 18:16
Before delving deeper into this plug-in, does it use the Task Scheduler API (http://technet.microsoft.com/en-us/library/ee176704.aspx)?
If so, does it have the same limitation as XP's command line schtasks (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true)?
By limitation I mean the inability to schedule a task with an empty password (in addition to the fact that it's not available in XP Home).
23rd September 2010, 22:39
does it use the Task Scheduler API (http://technet.microsoft.com/en-us/library/ee176704.aspx)?Yes! It creates the familiar job files in %WINDIR%\Tasks.
If so, does it have the same limitation as XP's command line schtasks (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true)?Yes. If the password for the account is empty, then the task would not start and logs the following error:
The attempt to retrieve account information for the specified task failed; therefore, the task did not run. Either an error occurred, or no account information existed for the task.
The specific error is:
0x8004130f: No account information could be found in the Task Scheduler security database for the task indicated.
The behavior of the existing "NSIS Scheduled Tasks" in my test system (XP SP2) is frustratingly unexplainable: The above error would occur if the scheduled job is produced by the script, but if the same exact task is opened via GUI and interactively uncheck-then-check the box "Run only if logged on", then the task would start.
Any explanation for that? How do I even begin to troubleshoot a problem like this (aside from looking at the log file and reading what I quoted above)?
24th September 2010, 03:40
Any explanation for that? How do I even begin to troubleshoot a problem like this (aside from looking at the log file and reading what I quoted above)?This problem is driving me crazy. I've combed the web and found many many posts describing a situation similar to what I described. For example:
But none of them would provide a clue as to why both NSIS flavors (the original NOT providing username/password & the latest one providing them) will not work on my test system.
As I was about to give up, I discovered that if I create a password for the Administrator account (under which I am trying to set the scheduled task), and provide both the correct username and password, then the test NSIS script would finally succeed.
Nice, but isn't the existence of TASK_FLAG_RUN_ONLY_IF_LOGGED_ON (0x2000) supposed to answer exactly a case in which we DON'T want to provide a password in the script?
Something is not right here, and I don't know whether it's a bug in Windows, a bug in the MSDN documentation, or a bug in the "Scheduled Tasks" script for NSIS.
Or a bug in my brain. :stare:
Could you please help?
24th September 2010, 15:08
This is a secretly undocumented feature by Microsoft. You can't schedule tasks on a Windows account with administrator privileges that has no password.
24th September 2010, 18:44
This is a secretly undocumented feature by Microsoft. You can't schedule tasks on a Windows account with administrator privileges that has no password.What??? This doesn't make sense. If Microsoft wanted to prohibit an Admin account with an empty password, it would have been disabled across the board, not only for the Task Scheduler.
Besides, Google's Chrome installed quite a few such (working!) scheduled tasks on my test machine having an Admin account with an empty password. Apple's iTunes did the same thing.
Also, created a scheduled task from the GUI (using the "Run only if logged on" checkbox) also works.
The problem must by lying elsewhere. I am becoming convinced that there is a bug in both NSIS "Scheduled Tasks" available scripts.
Has anyone (beside me) tested these scripts on an Admin account with an empty password?
26th September 2010, 18:59
What??? This doesn't make sense.
Of course it doesn't make sense but that's Microsoft. You don't have to believe me. I don't know if you discovered this already but in task scheduler you can't enter a path with spaces in it. For example if you have something in "C:\Program Files" you must use C:\Progra~1 instead. Makes sense? Of course not but that's Microsoft.
27th September 2010, 18:51
I don't know if you discovered this already but in task scheduler you can't enter a path with spaces in it. For example if you have something in "C:\Program Files" you must use C:\Progra~1 instead. Makes sense? Of course not but that's Microsoft
It turns out you were correct.
I was hoping that by using the NSIS "Scheduled Tasks" (http://nsis.sourceforge.net/Scheduled_Tasks) script I could avoid prompting the user for entering his password but since it needs the user password, too, I ended up using nsExec::Exec schtasks /create instead, which is documented at least and slightly more predictable.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.