I'm using the freeware software MultiMonitorTool to automate the configuration of displays on a Windows 11 computer.
I got two Batch scripts that "do" (disable the physical display) and "undo" (enable the physical display) using MultiMonitorTool.exe
. The file contents do not matter for this question. Everything works as expected, if I'm logged into the Windows command and execute the scripts.
I'm currently trying to automate the "undo" batch script execution using the Task Scheduler of Windows.
The main issue is that the MultiMonitorTool.exe
calls in the batch scripts only have an effect if the task option "Run only when user is logged on" is activated. I tested this by executing the task manually from the Task Scheduler GUI.
I tried different things, e.g. running the batch script using the SYSTEM
account and/or with the task option "Run with highest privileges" activated. All this doesn't help, the batch script does have an effect only if the task option "Run only when user is logged on" is activated.
The problem that follows the mentioned main issue is that I'm unable to execute the "Run only when user is logged on" task with the triggers "Boot" and the following two "Events":
- "Shutdown":
System
|User32
|1074
- "Wake Up":
System
|Power-Troubleshooter
|1
While "Wake Up" shouldn't work (the user is not logged in then), I assumed that "Shutdown" should work, but maybe this is triggered after logout.
I tried to workaround this limitation by using different triggers, e.g. "Logon", "On Workstation unlock" and "On Workstation lock". Some of these have an effect, but the issue with this approach is that these triggers are "too late", i.e. I've to interact with the computer dealing with a disabled display (if "do" has been called).
Do you have any suggestions how I can improve the task settings to ensure that the MultiMonitorTool.exe
calls in the batch script are successfully executed?
I'm already thinking about workarounds, such as trigger a "Run only when user is logged on" task by using a keyboard combination, but I don't know if that is possible (and the best solution). Any help is highly appreciated.