Windows Server 2012 R2 上的任务计划程序中的脚本不是 运行
Script not running from task scheduler on Windows Server 2012 R2
我有一个 Python 脚本需要每晚 运行 在几台服务器上运行。我在 Windows Server 2008 上设置了一个计划任务 运行,但在 Windows Server 2012 R2 上没有。最初,我是 运行ning,但在 2012R2 上,我登录时只有 运行s。我已经尝试 运行ning 作为域管理员用户和本地 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.
我已经看过的东西:
- Run batch file from Windows Task Scheduler regardless of user logged in 建议不要使用
映射驱动器,但我只访问 C: 驱动器。
- Unable to run a scheduled task in Windows Server 2012 R2 from Local Service account 建议 运行 以管理员身份执行任务;使用我的个人管理员帐户也仅在登录时有效。此外,我需要使用智能卡以管理员身份登录,因此尝试保存我的凭据不起作用。 (我可以 "check out" 一个密码,但它只能在 24 小时内有效。)
- windows server 2012 task scheduler file not found (0x80070002) 列出确切的
症状,但从未得到答复。
我从来没有找到这个问题的答案,所以我硬着头皮将我的脚本移到了我可以使用 cron 的 Linux 服务器上。抱歉,微软。
我有一个 Python 脚本需要每晚 运行 在几台服务器上运行。我在 Windows Server 2008 上设置了一个计划任务 运行,但在 Windows Server 2012 R2 上没有。最初,我是 运行ning,但在 2012R2 上,我登录时只有 运行s。我已经尝试 运行ning 作为域管理员用户和本地 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.
我已经看过的东西:
- Run batch file from Windows Task Scheduler regardless of user logged in 建议不要使用 映射驱动器,但我只访问 C: 驱动器。
- Unable to run a scheduled task in Windows Server 2012 R2 from Local Service account 建议 运行 以管理员身份执行任务;使用我的个人管理员帐户也仅在登录时有效。此外,我需要使用智能卡以管理员身份登录,因此尝试保存我的凭据不起作用。 (我可以 "check out" 一个密码,但它只能在 24 小时内有效。)
- windows server 2012 task scheduler file not found (0x80070002) 列出确切的 症状,但从未得到答复。
我从来没有找到这个问题的答案,所以我硬着头皮将我的脚本移到了我可以使用 cron 的 Linux 服务器上。抱歉,微软。