I have a Python script that needs to run nightly on several servers. I set up a scheduled task which runs on Windows Server 2008, but not on 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. I've tried both setting a starting path to C:\Temp and leaving it black. 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. Sorry, Microsoft.
User contributions licensed under CC BY-SA 3.0