How to run AutoHotKey script as an admin every time a user logs in?

1

1

I have computers where quite a few users log in. I want to restrict the usage to a maximum of 12 hours after which an ahk script logs off the user. I have the following solution but couldn't figure out the last part of it:

  1. Convert ahk script to exe.
  2. Launch the exe as a scheduled task at user logon
    https://stackoverflow.com/questions/5427673/how-to-run-a-program-automatically-as-admin-on-windows-startup

Joshua Frank's answer to a different question provides solution by running the task as system. I am not able to understand how to run a scheduled task as system. I explored the options of scheduled task but the best I can do is to run it with the highest privileges (not to mention hidden).

On a side note, is there a simpler way to run an ahk script (preferably its compiled exe) every time a user logs in, so that unless he/she is the admin, the script cannot be terminated?

Shashank Sawant

Posted 2013-10-13T15:59:24.387

Reputation: 672

Answers

2

You can type in SYSTEM as a user in the Task Scheduler:

task scheduler 1

Click "Change User or Group..." and type SYSTEM into the box.

system object

Make sure you set the task to trigger if any user logs in:

triggers

nc4pk

Posted 2013-10-13T15:59:24.387

Reputation: 8 261

1

You can disable AdminApprovalMode. This way you dont need to run as admin when you are admin. http://helpdeskgeek.com/windows-7/turn-off-admin-approval-mode-in-windows-7/

ColacX

Posted 2013-10-13T15:59:24.387

Reputation: 921