By default Windows Scheduled Tasks are created with the 'Start the task only if the computer is on AC power' setting enabled.
It is not possible to change this setting using schtasks.exe
, which would have been the simple solution. However, it appears that it is possible to do this through the Windows API ITaskSettings::get_DisallowStartIfOnBatteries
method. Can this be imported into Inno Setup in order to disable this setting, on an existing Scheduled Task, and allow it to run when the computer is on battery power? If so, how would this be done? Or is there another way to change this setting using Inno Setup?