I haven’t seen a response for this yet, but…  I have done work with the 
TaskScheduler in powershell, and in powershell you can do something like this:

PS C:\Users\Administrator.DOMAIN> (Get-ScheduledTask -TaskName mytask).Settings

AllowDemandStart                : True
AllowHardTerminate              : True
Compatibility                   : Win8
DeleteExpiredTaskAfter          :
DisallowStartIfOnBatteries      : True
Enabled                         : True
ExecutionTimeLimit              : PT72H
Hidden                          : False
IdleSettings                    : MSFT_TaskIdleSettings
MultipleInstances               : IgnoreNew
NetworkSettings                 : MSFT_TaskNetworkSettings
Priority                        : 7
RestartCount                    : 0
RestartInterval                 :
RunOnlyIfIdle                   : False
RunOnlyIfNetworkAvailable       : False
StartWhenAvailable              : False
StopIfGoingOnBatteries          : True
WakeToRun                       : False
DisallowStartOnRemoteAppSession : False
UseUnifiedSchedulingEngine      : True
MaintenanceSettings             :
volatile                        : False
PSComputerName                  :

“StartWhenAvailable” is what you are looking for.  You would set it to True

I don’t know how to get at the TaskScheduler from python without directing you 
to importing C DLLs and using the ctypes module, but I hope this helps.

As well, here is some documentation on TaskScheduler for Powershell

https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtasksettingsset?view=windowsserver2022-ps

Sorry, it’s not docs for python but I hope it helps you get closer to what you 
are looking for.

HTH

Steven
From: python-win32 <python-win32-bounces+steven=manross....@python.org> On 
Behalf Of Joel Moberg
Sent: Thursday, January 5, 2023 6:18 AM
To: python-win32@python.org
Subject: [python-win32] taskscheduler: how to tick setting "Run task as soon as 
possible after scheduled start is missed"

Maybe I can adjust the flag in the Trigger object but I have no idea what flags 
are available.
[cid:image001.png@01D92230.B0567150]
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to