[英]Script not running from task scheduler on Windows Server 2012 R2
I have a Python script that needs to run nightly on several servers. 我有一个Python脚本,该脚本需要在多台服务器上每晚运行。 I set up a scheduled task which runs on Windows Server 2008, but not on Windows Server 2012 R2. 我设置了计划任务,该任务在Windows Server 2008上运行,但不在Windows Server 2012 R2上运行。 Originally, it was running as myself, but on 2012R2, it only runs when I'm logged in. I've tried running as a domain admin user and as the local SYSTEM account, but no luck. 最初,它以我自己的身份运行,但是在2012R2上,它仅在登录后运行。我尝试以域管理员用户和本地SYSTEM帐户身份运行,但没有运气。 I've tried both setting a starting path to C:\\Temp and leaving it black. 我尝试过将C:\\ Temp的起始路径设置为黑色。 I've tried running with highest privileges. 我尝试以最高特权运行。 Here is the exported task from my most recent test. 这是我最近测试中导出的任务。
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-04-17T13:29:35.5882266</Date>
<Author>SYSTEM</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2018-04-17T07:22:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Python27\python.exe</Command>
<Arguments>-m ecs_capacity</Arguments>
<WorkingDirectory>C:\Temp</WorkingDirectory>
</Exec>
</Actions>
</Task>
Running this while not logged on results in this: 在未登录的情况下运行它会导致以下结果:
Task Scheduler successfully completed task "\ECS Capacity Reports (ADM)" , instance "{168f0587-2c93-49c5-9913-a70d70346630}" , action "C:\Python27\python.exe" with return code 2147942401.
Things I've already looked at: 我已经看过的东西:
I never found an answer to this, so I'm biting the bullet and moving my script over to a Linux server where I can use cron. 我从来没有找到答案,所以我很努力,将脚本移到可以使用cron的Linux服务器上。 Sorry, Microsoft. 抱歉,微软。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.