Schedule a task with admin privileges without a user prompt in windows 7

30

12

In windows 7, I'd like to schedule a program to be run with administrative privileges, without having the user need to respond to a prompt (which requests elevated privileges) every time the scheduled task is run. Is there any way to accomplish this goal without disabling UAC prompts for all applications?

Might not be relevant, but I'm trying to get this program to run at startup.

notAlex

Posted 2014-06-18T14:27:43.350

Reputation: 307

3What prompt are they getting now? a task can be scheduled with admin privaleges at the bottom of the first tab, check "Run with highest privaleges" – Wutnaut – 2014-06-18T14:38:44.230

As for running at startup: on the "triggers" tab choose new, then change the "on a schedule" drop-down to "on startup" – Wutnaut – 2014-06-18T14:39:56.287

The prompt is for an elevation of privileges to administrator privileges, I'll clarify in the question. – notAlex – 2014-06-18T17:39:15.173

Sounds like UAC, you'll have to disable it if you don't want your users prompted. – Wutnaut – 2014-06-18T17:46:17.613

That would work, but its desirable in my case for UAC to still prompt on other non-scheduled applications. I'll clarify again. – notAlex – 2014-06-18T18:29:30.473

Answers

49

  1. Open Task Scheduler

  2. Create a new task

  3. In the "General" tab - ensure the following settings are entered:

    • "Run whether user is logged on or not"

    • "Run with highest privileges"

    • "Configure For" (your operating system)

  4. In the "Triggers" tab, when adding a trigger (schedule) - ensure that the "Enabled" checkbox is checked

The other tabs need to be looked at as well (actions etc) - but these are the options you should specify when trying to ensure a task runs regardless of which user is logged in, and without the UAC prompts.

When saving the task, you will be prompted to enter a username and password - this username and password is the user that will be used to execute the task. If you are running the task with "highest privileges" you will need to make sure this is an admin account.

Fazer87

Posted 2014-06-18T14:27:43.350

Reputation: 11 177

3The problem is that if you use the Run whether user is logged on or not option, the program will not have a GUI (or tray icon). You have to disable that option for it to have a GUI, but then it can only run when the user logs in, which means it cannot run as admin. It’s a frustrating and common catch-22 that Microsoft missed and still seems to ignore. – Synetech – 2017-05-10T23:57:04.813

@Synetech If the user is there to use a GUI, the user is there to use the UAC prompt. – Damian Yerrick – 2017-06-08T14:27:26.970

Worked for me. But I don't understand why it was necessary to create a new task for this to start working. – boot13 – 2018-05-11T13:04:09.373

This works. But later I figured that if you happen to "Sleep" your computer, the opened app silently gets closed when waken up. Well at least that happened to Visual Studio. – Ε Г И І И О – 2018-05-25T14:42:01.607

But what is the admin password? – Moss – 2019-05-04T23:38:10.333

The admin password is whatever you set it to. If you don't know, you'll need to reset it. – Fazer87 – 2019-05-07T12:12:29.110

To get the application to run as if user accepted the UAC prompt (with GUI and everything): 1) In General tab instead choose "Run only when user is logged on" 2) For "At log on" trigger set "Delay task for" to something large enough, 30 seconds worked for me. – CrouZ – 2020-02-22T21:47:07.720

2

I am reading that the task needs to be scheduled to run under the NT AUTHORITY\SYSTEM account, in order to execute the job as an Administrator. "Highest privileges" hasn't produced the same effect for us. Note that in the SYSTEM-run job case, the GUI option is grayed out, so there will be no prompt.

access_granted

Posted 2014-06-18T14:27:43.350

Reputation: 131

2

You can provide administrator login. It will work:

enter image description here

Santosh Aundhekar

Posted 2014-06-18T14:27:43.350

Reputation: 21