Windows Task Scheduler: Difference between revisions

Content deleted Content added
m Removing link(s) Wikipedia:Articles for deletion/Computer Hope closed as delete (XFDcloser)
Windows Task Scheduler is included in ReactOS too, added it to infobox
 
(17 intermediate revisions by 14 users not shown)
Line 1:
{{Short description|Computer application of Microsoft Windows}}
{{distinguish|Windows Task Manager}}
{{Use mdy dates|date=December 2022}}
{{Infobox software
| name = Windows Task = Scheduler
| screenshot = Windows 7 Task Scheduler.png
| screenshot_size = 300px
| caption = [[Microsoft Management Console|Management console]] for Task Scheduler 23.0 in [[Windows 711]]
| developer = [[Microsoft]]
| released = {{Start date and age|1995}}
| other_names = <code>taskschd.msc</code>
| replaces = System Agent
| service_name = Task Scheduler (<code>Schedule</code>)
| programming language = [[C++]]
| included with = * [[Internet Explorer 4.0]] and later<br />([[Windows 95]] and [[Windows NT 4.0]])
* [[Windows 98]] and later<br />(Windows 9x family)
* [[Windows 2000]] and later<br />(Windows NT family)
* [[ReactOS]]<br />(Windows NT-like)
| genre = [[Windows service]]
}}
'''Task Scheduler''' is(formerly a'''Scheduled componentTasks''')<ref ofname=":0" [[Microsoft/> Windows]],is including the latest versiona [[Windowsjob 10scheduler]],<ref>{{cite book|author1-last=Leonhard|author1-first=Woody|author2-last=Rusen|author2-first=Ciprian|year=2021|title=Windows 10 All-in-One For Dummies|publisher=[[JohnMicrosoft Wiley & SonsWindows]]|isbn=978-1119680574}}</ref> that provides the ability to schedule the launch oflaunches [[computer program]]s or scripts at pre-defined times or after specified time intervals: [[job scheduling]] (task scheduling).<ref>{{Cite web|title=Keep your Windows desktop in shape with Task Scheduler|work=[[TechRepublic]]|date=January 4, 2002-01-04|url=https://www.techrepublic.com/article/keep-your-windows-desktop-in-shape-with-task-scheduler/}}</ref><ref>{{Cite web|title=What is Task Scheduler?|work=Computer Hope|date=2020-11-November 30, 2020|url=https://www.computerhope.com/jargon/t/tasksced.htm}}</ref> ItMicrosoft isintroduced implementedthis component in the [[Microsoft Plus!]] for [[Windows 95]] as a''System Agent.''<ref>{{cite web|author=Al Fasoltd|date=March 29, 1998|title=Windows 98: Stable and fast, as well as 'new and improved'|url=http://www.technofileonline.com/texts/tec032998.html|access-date=October 6, 2007|publisher=The Syracuse Newspapers}}</ref> Its core component is an eponymous [[Windows service]].<ref name="Mueller-2010">{{cite book|author-first=John Paul|author-last=Mueller|year=2010|title=Windows Command Line Administration Instant Reference|publisher=[[John Wiley & Sons]]|isbn=978-0470930908}}</ref> andThe wasWindows firstTask introducedScheduler ininfrastructure is the [[Microsoft Plus!]]basis for the [[Windows 95PowerShell]] asscheduled ''Systemjobs Agent''feature introduced with PowerShell v3.<ref>{{cite webbook|author-last=Warner|author-first=Timothy L.|year=2015|title=Sams Teach Yourself Windows PowerShell in 24 Hours|publisher=[[Sams Publishing]]|isbn=978-0134049359}}</ref>
| url = http://www.technofileonline.com/texts/tec032998.html
| title = Windows 98: Stable and fast, as well as 'new and improved'
| author = Al Fasoltd
| publisher = The Syracuse Newspapers
| date = March 29, 1998
| access-date = 2007-10-06
}}</ref> but was renamed to ''Task Scheduler'' in [[Internet Explorer 4.0]] and [[Windows 98]]. The [[Windows Event Log]] service must be running before the Task Scheduler starts up. The Windows Task Scheduler infrastructure is the basis for the [[Windows PowerShell]] scheduled jobs feature introduced with PowerShell v3.<ref>{{cite book|author-last=Warner|author-first=Timothy L.|year=2015|title=Sams Teach Yourself Windows PowerShell in 24 Hours|publisher=[[Sams Publishing]]|isbn=978-0134049359}}</ref>
 
Task Scheduler can be compared to [[cron]] or [[anacron]] on [[Unix-like]] [[operating system]]s. This service should not be confused with the [[Scheduling (computing)#Windows|scheduler]], which is a core component of the OS [[kernel (computingoperating system)|kernel]] that allocates [[CPU]] resources to processes already running.
 
==Versions==
Line 33 ⟶ 29:
| url = http://msdn2.microsoft.com/en-us/library/aa446802.aspx
| title = About the Task Scheduler
| access-date = October 6, 2007-10-06
| work = [[MSDN]]
| publisher = [[Microsoft]]
}}</ref> It runs as a [[Windows Service]], and the task definitions and schedules are stored in [[Binary file|binary]] <code>.job</code> files. Tasks are manipulated directly by manipulating the <code>.job</code> files. Each task corresponds to single action. On [[Windows 95]] (with [[Internet Explorer 4.0]] or later), [[Windows 98]] and [[Windows Me]], the Task Scheduler runs as an ordinary program, <code>mstask.exe</code>. It also displays a status icon in the notification area on Windows 95 and Windows 98 and runs as a hidden service on Windows Me, but can be made to show a tray icon.<ref name=":0">{{cite web|url=http://support.microsoft.com/kb/272962|title=How to Enable the Scheduled Tasks Icon in Windows Me|date=January 29, 2007|work=Support|publisher=[[Microsoft]]|url-status=dead|archive-url=https://web.archive.org/web/20080130185556/http://support.microsoft.com/kb/272962|archive-date=January 30, 2008}}</ref> Computer programs and [[Scripting language|scripts]] can access the service through six [[Component Object Model|COM]] [[Interface (computing)|interfaces]].<ref>{{Cite web|url = https://msdn.microsoft.com/en-us/library/windows/desktop/aa383581%28v=vs.85%29.aspx|title = Task Scheduler 1.0 Interfaces|access-date = 30 May 30, 2014|website = [[MSDN]]|publisher = [[Microsoft]]}}</ref> Microsoft provides a scheduling agent DLL, a sample [[VBScript]] and a configuration file to automate Task Scheduler.<ref>{{cite web|url=http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=601d75e2-f907-4e51-ad88-adb818df1d27|title=Task Scheduler Using VBScript|work=Download Center|publisher=[[Microsoft]]|date=March 22, 2004|url-status=dead|archive-url=https://web.archive.org/web/20060504033359/http://www.microsoft.com/downloads/details.aspx?FamilyID=601d75e2-f907-4e51-ad88-adb818df1d27&displaylang=en|archive-date=May 4, 2006}}</ref>
 
In addition to the graphical user interface for Task Scheduler in [[Control Panel (Windows)|Control Panel]], Windows provides two command-line tools for managing scheduled task: <code>[[at (command)|at.exe]]</code> (deprecated)<ref>{{cite web|url=https://www.computerhope.com/at.htm|title=MS-DOS and Windows command line at command|access-date=7 March 7, 2021|website=Computer Hope}}</ref> and <code>schtasks.exe</code>.<ref name="Mueller-2010" /><ref>{{cite web|title=Schtasks|url=https://technet.microsoft.com/en-us/library/bb490996.aspx|work=[[Microsoft TechNet]]|publisher=[[Microsoft]]|access-date=18 May 18, 2014}}</ref><ref>{{cite web|title=At|url=https://technet.microsoft.com/en-us/library/bb490866.aspx|work=[[Microsoft TechNet]]|publisher=[[Microsoft]]|access-date=18 May 18, 2014}}</ref> However, <code>at.exe</code> cannot access tasks created or modified by Control Panel or <code>schtasks.exe</code>.<ref>{{Cite web|url = http://support.microsoft.com/kb/313565|title = How To Use the AT Command to Schedule Tasks|date = 30 October 30, 2006|website = Support|publisher = [[Microsoft]]}}</ref> Also, tasks created with <code>at.exe </code>are not interactive by default; interactivity needs to be explicitly requested. The binary ".job" files which the AT command produces are stored in the %WINDIR%\Tasks directory.<ref>{{cite book|author1-first=Dave|author1-last=Kleiman|author2-first=Laura E|author2-last=Hunter|year=2006|title=Winternals Defragmentation, Recovery, and Administration Field Guide|publisher=[[Elsevier]]|isbn=978-0080489872}}</ref><ref>{{Cite web|url = http://support.microsoft.com/kb/121562/EN-US|title = Applications Started with AT Are Not Interactive|date = 20 February 20, 2007|website = Support|publisher = [[Microsoft]]|url-status=dead|archive-url=https://web.archive.org/web/20041029024318/http://support.microsoft.com/kb/121562/EN-US/|archive-date=October 29, 2004}}</ref>
 
===Task Scheduler 2.0===
Line 46 ⟶ 42:
|last1=Paul|first1=Ian
|work=[[PCWorld]]
|date=September 5, 2014-09-05
|access-date=2021-03-March 15, 2021
}}</ref> logoff, or only during or for a specified time. [[XPath]] expressions can be used to filter events from the [[Windows Event Log]]. Tasks can also be delayed for a specified time after the triggering event has occurred, or repeat until some other event occurs. Actions that need to be done if a task fails can also be configured. The actions that can be taken in response to triggers, both event-based as well as time-based, not only include launching applications but also take a number of custom actions. Task Scheduler includes a number of actions built-in, spanning a number of applications; including send an e-mail, show a message box, or fire a [[Component Object Model|COM]] handler when it is triggered. Custom actions can also be specified using the Task Scheduler API. Task Scheduler keeps a history log of all execution details of all the tasks.<ref name="taskscheduler">{{cite web
|url=http://www.microsoft.com/technet/windowsvista/mgmntops/taskschd.mspx
Line 59 ⟶ 55:
|archive-date=April 12, 2006
}}</ref> Windows Vista uses Task Scheduler 2.0 to run various system-level tasks;<ref>{{cite web|url=http://support.microsoft.com/kb/939039|title=Description of the scheduled tasks in Windows Vista|date=August 24, 2007|url-status=live|archive-url=https://web.archive.org/web/20071022033307/http://support.microsoft.com/kb/939039|archive-date=October 22, 2007}}</ref> consequently, the Task Scheduler service can no longer be disabled (except with a simple registry tweak).
[[Image:Windows 7 Task Scheduler.png|thumb|right|Task Scheduler 2.0 in [[Windows 7]]]]
 
Task Scheduler 2.0 exposes an [[API]] to allow computer programs and scripts create tasks.<ref name="VBSPR" /><ref name="kerr">{{cite web
| url = http://msdn.microsoft.com/msdnmag/issues/07/10/WindowsCPP/
Line 66 ⟶ 62:
| work = [[MSDN]]
| publisher = [[Microsoft]]
| access-date = October 6, 2007-10-06
| date = October 2007
| url-status=dead
| archive-url = https://web.archive.org/web/20071226223747/http://msdn.microsoft.com/msdnmag/issues/07/10/WindowsCPP/
| archive-date = December 26, 2007
}}</ref> It consists of 42 [[Component Object Model|COM]] [[Interface (computing)|interfaces]].<ref>{{Cite web|url = https://msdn.microsoft.com/en-us/library/aa383600%28v=vs.85%29.aspx|title = Task Scheduler 2.0 Interfaces|access-date = 30 May 30, 2014|website = [[MSDN]]|publisher = [[Microsoft]]}}</ref> The Windows API does not, however, include a [[Managed code|managed]] wrapper for Task Scheduler though an open source implementation exists.<ref>{{Cite web|url=https://stackoverflow.com/questions/3977801/c-sharp-api-for-task-scheduler-2-0|title=C# API for Task Scheduler 2.0|website=Stack Overflow|access-date=2019-07-July 24, 2019}}</ref> The job files for Task Scheduler 2.0 are [[XML]]-based, and are human-readable, conforming to the ''Task Scheduler Schema''.<ref name="VBSPR" /><ref name="kerr"/>
 
====Other features====
Line 84 ⟶ 80:
| work = [[MSDN]]
| publisher = [[Microsoft]]
| access-date = October 6, 2007-10-06
}}</ref>
 
==Column 'Last Result'==
The Last Result column displays a completion code. The common codes for scheduled tasks are:<ref>{{cite web|title=How to troubleshoot scheduled tasks in Windows XP and in Windows Server 2003|url=http://support.microsoft.com/kb/308558|work=Support|publisher=[[Microsoft]]|access-date=September 3 Sep, 2013|date=22 May 22, 2013}}</ref><ref>{{cite web|url=http://msdn.microsoft.com/en-gb/library/windows/desktop/aa383604(v=vs.85).aspx|title=Task Scheduler Error and Success Constants|work=[[MSDN]]|publisher=[[Microsoft]]}}</ref>
 
{{Div col|small=yes}}
Line 137 ⟶ 133:
* 0x80041327: The task has properties that are not compatible with earlier versions of Windows.
* 0x80041328: The task settings do not allow the task to start on demand.
* 0x80070002: The Task Scheduler cannot find the file.
* 0x800710E0: The operator or administrator has refused the request.
* 0xC000013A: The application terminated as a result of a CTRL+C.
* 0xC0000142: The application failed to initialize properly.
Line 142 ⟶ 140:
 
==Bugs==
On Windows 2000 and Windows XP, tasks assigned to run with SYSTEM privileges do not function when thea computer is prepared for [[disk imaging]] with <code>the [[sysprep]]</code> utility, it cannot run tasks configured to run in the context of the [[Superuser|SYSTEM account]]. Sysprep changes the [[security identifier]] (SID) to avoid duplication but does not update scheduled tasks to use the new SID. Consequently, allthe SYSTEM scheduledaffected tasks fail to run on the imaged computers. There is no solution for this problem but one may reschedule the affected tasks to work around the issue.<ref>{{cite web|title=Scheduled tasks may not start if you used a System Preparation image to install Windows XP or Windows 2000|url=http://support.microsoft.com/kb/313111|work=Support|publisher=[[Microsoft]]|access-date=19 May 19, 2012|date=1 July 1, 2004|url-status=dead|archive-url=https://web.archive.org/web/20080926011921/http://support.microsoft.com/kb/313111|archive-date=26 September 26, 2008}}</ref>
 
On Windows Vista or Windows Server 2008, where Service Pack 2 is not installed,<!-- To source checkers: You need to expand tables in File information section to reveal this information --> the next execution time displayed in Task Scheduler may be wrong. Microsoft issued a [[hotfix]] to remedy this issue.<ref>{{cite web|date=October 15, 2008|title=The value in the Next Run Time field in Task Scheduler is incorrect in Windows Vista and in Windows Server 2008|url=http://support.microsoft.com/kb/950035|workurl-status=Supportlive|publisherarchive-url=[[Microsoft]]https://web.archive.org/web/20081211175231/http://support.microsoft.com/kb/950035|accessarchive-date=19December May11, 20122008|datework=15 October 2008Support|publisher=[[Microsoft]]}}
</ref>
 
On Windows Vista, 7, 2008, and 2008 R2: The [[Microsoft Management Console|MMC]] Component says that the system is running "Task Scheduler 1.0" when in fact it is running 2.0, this is a trivial bug so it wasn't noticed, and is likely due to the re-write of the task scheduler. The version has been corrected to 2.0 in Windows 8 and in 2012.
 
==See also==
*[[cron]], job scheduler for Unix-like operating systems
*[[Job scheduling]]
*[[cron]]
 
==References==