Windows server 2008 task scheduler does not run task at start up

时间:2015-07-28 15:42:07

标签: scheduled-tasks windows-server-2008 windows-server-2008-r2

I have VPS with Windows Server 2008. I have configured Task Scheduler to run the *.exe (please, see below XML file I retrieved from c:\Windows\System32\Tasks\Chronos\). The Run on startup trigger is enabled (I suppose it is BootTrigger).

The task runs and works until the Windows reboots due to updates or other reasons. The task is not started after reboot. I must login to Windows and manually start Task Scheduler, select the task and press Run button). Why it does not launch the task on Windows startup?

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2014-09-06T16:47:00.9812</Date>
    <Author>VMI28078\Administrator</Author>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Enabled>true</Enabled>
    </BootTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <RunLevel>LeastPrivilege</RunLevel>
      <UserId>VMI28078\chronos</UserId>
      <LogonType>S4U</LogonType>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
    <Priority>7</Priority>
    <RestartOnFailure>
      <Interval>PT1M</Interval>
      <Count>999</Count>
    </RestartOnFailure>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>D:\chronos\gate\ChronosGate.exe</Command>
      <Arguments>rVPSgate.config</Arguments>
      <WorkingDirectory>D:\chronos\gate</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

1 个答案:

答案 0 :(得分:-1)

Web有很多关于使用INSTSRV或SC的建议,但是:

  • Windows Server 2008 R2中不存在INSTSRV.EXE
  • SC.EXE没有帮助,因为它不允许使用* .bat文件创建服务(我需要将命令行参数传递给我的* .exe,这可以使用* .bat文件来完成)
  • cron for windows - 也许是的,我没有尝试

最简单的方法是使用具有GUI的http://nssm.cc,对我来说就像一个魅力。