4.1.3 Task XML Example
The following is an example of a task configuration XML. The XML in this example defines a task that starts Notepad when a user logs on. The task has a single execution action (starting Notepad), a single logon trigger that starts the task when a user logs on, and several other task settings that affect how the task is handled by the Task Scheduler Remoting Protocol. The <Principal> is set to the built-in Administrators group, indicating that the task runs for any user who is part of this group.
-
<?xml version="1.0" ?> <!-- This sample schedules a task to start notepad.exe when a user logs on. --> <Task xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2005-10-11T13:21:17-08:00</Date> <Author>AuthorName</Author> <Version>1.0.0</Version> <Description> Starts Notepad when a specified user logs on. </Description> </RegistrationInfo> <Triggers> <LogonTrigger> <StartBoundary>2005-10-11T13:21:17-08:00</StartBoundary> <EndBoundary>2006-01-01T00:00:00-08:00</EndBoundary> <Enabled>true</Enabled> </LogonTrigger> </Triggers> <Principals> <Principal> <GroupId>Builtin\Administrators</GroupId> </Principal> </Principals> <Settings> <Enabled>true</Enabled> <AllowStartOnDemand>true</AllowStartOnDemand> <AllowHardTerminate>true</AllowHardTerminate> </Settings> <Actions> <Exec> <Command>notepad.exe</Command> </Exec> </Actions> </Task>