Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a script that creates some scheduled tasks on a Windows Server 2008 R2 box using schtasks.exe, and I'd like that script to set the 'If an instance of the task is already running, run new instances in parallel' setting.

I've poked around the documentation and options for schtasks.exe (which is what I'm using to create the tasks), and don't see any way to set this setting through a script.

Anyone know whether there's an option or other utility that I'm missing?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The only way that I have been able to find to set that option in a scripted way is to edit the XML of the task itself. You are specifically looking for the TaskSettings.MultipleInstances property.

For example, a task that I have on my Windows 7 machine looks, in part, like this:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

[...]

  <Settings>
    <MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>

[...]

  </Settings>

Notice the <MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy> section. My only thoughts right now are to insert the XML programatically after the task is created.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.