Task Scheduler Options

Hey guys,

I have a simple script to create multiple scheduled tasks, but am curious if there is a way to add in the option to select the "Run with highest privileges" and also the "Start In" path under the Actions tab.

This is what we are using to create the scripts, but it would be nice to not have to go back in and select/input those options.

schtasks /create /ru %domain%\administrator /RP ******** /SC DAILY /TN Midday-SFTP /TR D:\NS5\6.2.1-GA\Standard\scripts\Midday-SFTP.cmd /ST 19:00

April 23rd, 2015 1:07pm

This is not a scripting question. It is a question about how to use a utility program.  I recommend posting in the forum for you OS.

You could also use your search engine to find examples of how to use the utility.

Free Windows Admin Tool Kit Click here and download it now
April 23rd, 2015 1:15pm

Hi Mjannise,

one piece of advice: The first target I'd ask when trying to figure out how a command works, is the command itself:

schtasks /create /?

Reading this text (quite a bit, I admit) will direkt you to the /RL Parameter and its usage.

I don't see how you can change the Start-In path using schtasks, however you could ...

a) Write the path into the script
b) Pass the path to the script as parameter
c) Write the task as an xml file and pass the XML definition to schtasks (You can export a task as XML from the task-scheduler)

Cheers,
Fred

April 24th, 2015 3:24am

As per Fred - Jason Morgan to the rescue: http://blogs.technet.com/b/heyscriptingguy/archive/2013/12/14/working-with-task-scheduler-xml.aspx

Free Windows Admin Tool Kit Click here and download it now
April 24th, 2015 5:22am

Thank you, Fred!

April 24th, 2015 8:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics