Thursday, May 27, 2010

Autostart application that requires UAC on user logon in windows 7 without verifying them

I wanted to make windows autorun some application (like openvpn-gui and SQL 2005 Service Manager) whenever I logged in in order to have them loaded in the tray. Placing them in the Startup folder would autostart them but I had to confirm both of them in the UAC (User Account Control) since they both run as administrator. In order to bypass this, I had to schedule them in the windows scheduler. In order to do so you must follow the following steps.


Press the windows key and type “Task Scheduler” or any part of it to launch (by pressing enter when you have it selected in the results) Task Scheduler.

In the actions menu on the right, click “Create task”



In the “General” tab, you must specify the task’s name (which you will not be able to change once you have created the task) and you must also check the “Run with highest privileges” checkbox. This checkbox forces windows to run the application in a higher security context and the application doesn’t require the UAC verification. I also change “Configure for:” drop down in order to reflect my current operating system, but you may choose a previous configuration for better compatibility.



In the “Triggers” tab, you must add a logon trigger by pressing the “New…” button.



In the “New trigger” window you must select “At log on” in the “Begin the task:” drop down list and then you may specify that the task will be running only on specific user, if you like, as seen in the next image.


In the “Actions” tab, you will have to specify the program that you want to run, by clicking the “New…” button.


Select the program (by clicking “Browse…”) and then press the OK button.



If you are tempted to add more than one application in this tab, think again, since Task Scheduler waits for the first application to close in order to proceed to the next one. In my case that I wanted two applications to run on log and stay for the rest of the session, I had to create two separate tasks.

The next steps are optional.

In the “Conditions” tab, I personally uncheck the “Start the task only if the computer is on AC power”.



Finally in the “Settings” tab I also uncheck both “Stop the task if it runs longer than” (since I want it to be running for ever) and the “If the running task does not end when requested, force it to stop” checkboxes.



Click OK and you are ready to go. In order to modify the task you may select it in the main panel as shown in the following image.


Enjoy!

No comments: