[python-win32] taskscheduler: how to tick setting "Run task as soon as possible after scheduled start is missed"
Steven Manross
steven at manross.net
Sat Jan 7 02:44:32 EST 2023
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.net at python.org> On Behalf Of Joel Moberg
Sent: Thursday, January 5, 2023 6:18 AM
To: python-win32 at 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 at 01D92230.B0567150]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20230107/3719410a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13574 bytes
Desc: image001.png
URL: <https://mail.python.org/pipermail/python-win32/attachments/20230107/3719410a/attachment-0001.png>
More information about the python-win32
mailing list