我有一个Python脚本,需要在几台服务器上每晚运行。我设置了一个在Windows Server 2008上运行但不在Windows Server 2012 R2上运行的计划任务。最初,它是以我自己的身份运行,但是在2012R2上,它只在我登录时运行。我尝试以域管理员用户身份运行,并作为本地SYSTEM帐户运行,但没有运气。我已经尝试将起始路径设置为C:\ Temp并将其保留为黑色。我尝试过以最高权限运行。这是我最近测试中的导出任务。
<?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>
未登录时运行此结果会导致:
Task Scheduler successfully completed task "\ECS Capacity Reports (ADM)" , instance "{168f0587-2c93-49c5-9913-a70d70346630}" , action "C:\Python27\python.exe" with return code 2147942401.
我已经看过的事情:
答案 0 :(得分:0)
我从来没有找到答案,所以我咬紧牙关并将我的脚本移到我可以使用cron的Linux服务器上。对不起,微软。