adding startup scripts/programs executed as admin (from here):
-
open 'Task Scheduler'
-
click 'Create Task'
-
in 'General' tab:
- select name, e.g. 'run-sync-time'
- tick 'Run only when user is logged on' or 'Run whether user is logged on or not' (mainly using latter, but see below where former is needed, e.g. ahk's keybindings)
- tick 'Run with highest privileges'
-
in 'Triggers' tab, add New and Begin the task->At startup
- or alternatively 'At logon' & Specific user: select your user (or just go w/
Any user) - again, see below where
At startupwon't work (e.g. ahk's keybindings)
- or alternatively 'At logon' & Specific user: select your user (or just go w/
-
in 'Actions' tab, choose 'Start a program' from dropdown add new and point script/program path to target
-
in 'Conditions' tab, at the botton under 'Network' section, tick 'Start only if...', and select 'Network' from dropdown- !! nope, looks like it's broken. if you
Enable All Tasks Historyand reproduce, then in task's History tab I gotTask Category: Launch condition not met, network unavailable. Instead of this condition, just add a delay under the trigger: advanced settings -> delay for X seconds. Or add network-waiting loop in the script itself.
- !! nope, looks like it's broken. if you
-
note root_startup/ dir also contains some exported task scheduler jobs (.xml) as reference
- important: for our
super-L-idle-lock.ahkto actually run, we had to change Trigger toAt log on of any userunderTriggerstab; and to make sure the keybinds defined in it also work,Run only when user is logged onhad to be selected underGeneraltab. also not a bad idea to untickStop the task if it runs longer than:underSettingstab. This info comes, more-or-less, from this AHK forum post
- important: for our
- create link/shortcut to startup folder (ctrl+r ->
shell:startup) - right click on shortcut -> properties -> shortcut tab -> advanced -> tick
run as administrator - as noted, this method doesn't work. haven't tested, but it's possible to get it to work if our program is launched by a vbscript wrapper, see this superuser answer