Is ITaskScheduler supported in Windows 7?
Is ITaskScheduler
supported in Windows 7?
I've used the Task Scheduler in Windows XP and Windows Vista to create scheduled tasks.
On Windows 7 the job gets (correctly) created, for example:
C:\Windows\Tasks\Foo Test Task.job
But the task never runs and doesn't appear in the Task Scheduler UI (Start -> Task Scheduler):
Note: According to MSDN, ITaskScheduler
is part of the now deprecated Task Scheduler 1.0 API. New applications should use ITaskService
, part of Task Scheduler 2.0.
Since ITaskScheduler
doesn't work (for me) under Windows 7 (but did work under Windows Vista) I wonder if it's no longer supported (even though the the COM objects exist, the code causes no errors, and it creates the job).
While MSDN doesn't include Windows 7 in开发者_高级运维 the list of supported OS's for Task Scheduler 1.0, it also doesn't even say that Windows 7 supports Task Scheduler 2.0:
Run-Time Requirements
The Task Scheduler requires the following operating systems.
- Task Scheduler 1.0: Client requires Windows Vista, Windows XP, Windows 2000 Professional, Windows Me, or Windows 98. Server requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
- Task Scheduler 2.0: Client requires Windows Vista. Server requires Windows Server 2008.
So officially no task scheduler API is supported on Windows 7.
But is ITaskScheduler
supported on Windows 7?
Is it expected to work?
Judging by the community comments on the Task Scheduler homepage, I guess not:
Task Scheduler 1.0 under Windows Vista, Windows 7 etc.
Is it really possible to use Task Scheduler 1,0 under Windows Vista and Windows 7? How can it be done?Task Scheduler work-around for Win7
I have the same trouble with Win7 Task Scheduler - Creating a simple task to launch a script/program does not work.I exported my non-working task as well as a working MS task and compared them. I changed the following parameter in my exported task and re-imported it and now it works: <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
This work-around is getting me by for now.
Other thoughts: There does not appear to be a Task Scheduler GUI setting to affect this parameter? The API description implied a setting of false should work, but for some reason it doesn't? It's hard to believe such a fundemental overshight exists; could it be something else with my Win7 setup that requires the true setting? I seem to recall the same problem with a fresh Vista install in the past that was mysteriously resolved before I investigated a work-around. Hmmm... I think I read also that the new scheduling engine associated with the true setting curiously does not support things like monthly scheduling....?
Task Schedule in Windows 7 fails but works in Windows XP Pro
I have a scheduled task that executes perfectly well in Windows XP Pro but the same task in Windows 7 returns a "0x2" under "Last Run Result". According to the command line command, "net helpmsg 2", "0x2" equates to "The system cannot find the file specified."I can certainly find the file, and the path I use in the Actions tab has been checked, re-checked, double-checked and triple-checked.
I have read countless posts in multiple forums about this issue. I have yet to find a satisfactory answer.
The action that the task is supposed to execute is a .bat file that calls a Perl script. The Perl script writes one each of the following file types, .txt, .csv, and .xml. Execution of the .bat file from the command line works perfectly well; however, once it is put into a Windows 7 scheduled task, it returns 0x2. This same task under Windows XP Pro works like a champ. What is it about Windows 7 tasks that make it so difficult to execute successfully?
After Vista you need to use the Task Scheduler 2.0 interface instead of 1.0. Partially can handle the w7 the old scheduler app's, but been lot of diffs between.
If you need to create a cross-platform (xp/vista/w7/w8) scheduler, you need to handle the operating system version and the interfaces. Lot of extra work, but better than create one solution with old interface.
精彩评论