Hello, I'm trying to create a Scheduled Task under Windows Server 2003 R2 with this config:

<addScheduledTask>
        <dayOfMonth>1</dayOfMonth>
        <duration>1440</duration>
        <endDate></endDate>
        <interval>60</interval>
        <name>${taskName}</name>
        <password></password>
        <period>1</period>
        <program>${installdir}\autoupdate-windows.exe</program>
        <programArguments>--mode unattended --unattendedmodebehavior download</programArguments>
        <progressText>add scheduled task ${taskName}</progressText>
        <runAs>NT AUTHORITY\SYSTEM</runAs>
        <runAsAdmin>1</runAsAdmin>
        <runOnlyIfLoggedOn>0</runOnlyIfLoggedOn>
        <startDate></startDate>
        <startTime></startTime>
        <weekDays>*</weekDays>
    </addScheduledTask>

after installation the task is created with the current user and not with the system account. Install logfile:

add scheduled task nahar updater
password cannot be blank
Unable to create scheduled task nahar updater

I hope you guys can help me. Thanks! Martin

asked 19 Jun '12, 07:06

Martin%20Pecuch's gravatar image

Martin Pecuch
11223
accept rate: 0%


The issue is that the mstask API returns that access is denied to use the <runas> account and registers the task to be run as current user.

It is not possible to create a scheduled task to run as SYSTEM user.

link

answered 19 Jun '12, 07:45

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

With schtasks ist this possible: http://support.microsoft.com/kb/814596

schtasks /create /tn test /tr "c:\Program Files\Gekko\nahar\autoupdate-windows.exe --mode unattended --unattendedmodebehavior download" /du 0024:00 /ru System /ri 60 /sc daily
(19 Jun '12, 08:45) Martin Pecuch

Indeed. It seems the only option then is to use <runProgram> and schedule it manually:

<runProgram>
  <program>schtasks</program>
  <programArguments>/create /tn "${taskName}" /tr "${installdir}/autoupdate-windows.exe --mode unattended --unattendedmodebehavior download" /du 0024:00 /ru System /ri 60 /sc daily</programArguments>
</runProgram>
(19 Jun '12, 10:08) wojciechka ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×176
×12
×2

Asked: 19 Jun '12, 07:06

Seen: 3,015 times

Last updated: 19 Jun '12, 10:09