How to run a program as an administrator at startup on Windows 10?

43

18

We have a program that is having problem starting up on Windows 10. If the program is NOT run as administrator, it popups a "Access Denied" message right before it starts. If we run the program as an administrator, it does NOT popup any error message and loads normally. However, now the program won't run at STARTUP. So, we need to run our program as administrator and be able to automatically run the program at startup.

Update: Even though my question and the duplicate question maybe the same but the answers provided for both questions did not solve my problem. Task Scheduler only starts my application or program as a background process. Thus, my program doesn't load. However, I do see my process in the task manager under background process. That's all.

ThN

Posted 2015-06-17T18:54:30.873

Reputation: 827

Question was closed 2016-12-01T17:53:24.600

@Moab: Can you confirm that the duplicate applies to Win 10? – fixer1234 – 2015-06-18T02:52:52.640

@Ramhound Yes it does, but task scheduler does not start my program normally but as a background process. That's not what I am looking for. Am I missing something? – ThN – 2015-06-18T12:34:27.893

@fixer1234 if you are specifically talking about my question and the question marked as a duplicate, then no. My question is related to Windows 10 and the duplicate is related Windows 7. – ThN – 2015-06-18T12:36:39.583

@Ramhound You are right, but one question is specifically asking for Windows 10 solution and the other one is for Windows 7 even though both solutions apply windows 10. – ThN – 2015-06-18T12:56:53.557

@Ramhound Yes, you are right. You asked how my question and the duplicate question are different. I told you other than Windows versions, they are both the same. you can go ahead and mark my question as duplicate if you want. – ThN – 2015-06-18T13:08:20.840

@ThN: That was the purpose of my question. Solutions may or may not work across different Windows versions. I don't want to vote this as a duplicate if the solutions don't apply to Win 10. If they do apply, the specificity to Win 7 in the other question doesn't matter. – fixer1234 – 2015-06-18T15:29:08.900

To maybe clarify what the questioner is trying to do, and why a background process is not OK, I have this problem on the release version of Win10: I want to run Dbgview at startup as admin so I can see the results of "Capture Global Win32 Output". If I put a shortcut in the Startup folder and check "run as administrator", it doesn't launch. On Win8.1, this works fine. – jeffm – 2015-08-06T17:52:10.950

Answers

24

This is a little old, but I was having the same problems, and none of the above was working. What I did was create a VBScript that ran at startup that opened said program.

1) Right-click on the program, go to properties, then compatibility and check "Run as Administrator"

2) Create the VBScript using a text editor (I use Notepad++)

Script:

  Set WshShell = CreateObject("WScript.Shell" ) 
  WshShell.Run """C:\Program Files (x86)\File\Program.exe""", 0 'Must quote command if it has spaces; must escape quotes
  Set WshShell = Nothing

Note: that C:\Program Files (x86)\File\Program.exe is the full path to the program with extension. Also, make sure to save it as a .vbs

3) Now place the VBScript in the startup folder:

%AppData%\Microsoft\Windows\Start Menu\Programs\Startup

Or, alternatively access it by Win+Rshell:startupEnter

I used this instead of a batch file because I did not want that ugly command window showing up.

Andrew

Posted 2015-06-17T18:54:30.873

Reputation: 256

You can use %appdata% instead of your personalized AppData\Roaming – Ben Philipp – 2016-03-05T15:32:50.703

This is exactly what I end up doing, but I used Delphi to write a mini program which will call my program at startup. This mini program ran at startup. This workaround did the job. – ThN – 2016-03-06T00:13:52.660

I found that that to invoke an elevated shortcut so that it ran as elevated, I had to let the script start cmd.exe with /c option to run the shortcut. – Alf P. Steinbach – 2016-08-15T14:43:47.520

To be clear, this still prompts the user to say if they want to run the program as administrator, right? This startup trick doesn't bypass that somehow, right? – Kyle Delaney – 2018-05-02T19:56:12.953

There should be a built-in/native way of doing this. – HolyAvengerOne – 2018-08-08T16:02:04.413

if it doesn't for you follow this tutorial: https://www.sevenforums.com/tutorials/11949-elevated-program-shortcut-without-uac-prompt-create.html

– Farid Cheraghi – 2018-10-11T13:13:48.937

A problem I have with this is that I need it to use the shell:common startup folder. It needs to run as administrator for every user. When selecting "Run as Administrator" in the properties it only counts for the user that has performed this action. I need a solution that will work for every user that logs on the pc, without manually doing if for all the users. – marijnr – 2018-10-17T13:00:43.260

If I double click my program (a shortcut really) the UAC pops up and I can run it in elevated mode. However, the vbs script above doesn't start the shortcut in elevated mode, so I don't get a UAC popup and the program is started without admin priv – niCk cAMel – 2019-05-16T09:45:07.170

32

Create a Scheduled Task to trigger at log on.

In the Create Task dialog, select the following:

  1. General (tab) - Run with highest privileges
  2. Triggers (tab) - New (button) - Begin the task - At log on

Steven

Posted 2015-06-17T18:54:30.873

Reputation: 24 804

2I did follow your answer but it starts the program as a background process not as an application. As a result, nothing loads in the screen and the process is listed under background process in the Task Manager. – ThN – 2015-06-17T20:31:28.560

Will the program need to be run for any user logging on or just the user primarily logged in? – Steven – 2015-06-18T22:38:43.357

The user that logins in when the system boots up is Admin with full privileges. I learned from other superuser question that Task Scheduler by default runs program only as NON-Admin-privileged. Thus, the program runs as background process even though "run with highest privileges" checkbox is checked. – ThN – 2015-06-19T12:55:19.140

2this is actually an A LOT better answer than the previous, be cause you can program a daemon to start when computer start and no user is logged on, for example I need to start deluged at computer start even me or any1 else will log on on that computer (deluge is a torrent client, which in non classic mode will become client/server, therefore I don't need client started to have the server running), the only other solution but this is to have it started by another service (like cygwin's cron) or to make it a service (and to do that manually if the software makers didn't design it like this) – THESorcerer – 2016-07-01T08:11:45.530

It runs when I manually start it (as some kind of service, no windows or dialogs), it is a batch file, but does not run when I switch on the computer. Also tried it with the startup folder but doesn't work either. Why do they make this so difficult. – Codebeat – 2017-05-04T22:23:33.103

1@ThN You can try to add a small delay, 10-15 seconds, to the trigger. That fixed the "running in the background" for me. That was for a AutoHotkey script, don't know if it applies to your problem. – Anders Jørgensen – 2017-05-24T06:23:36.677

2At first it was not working for me either, but only because I had set the trigger to "At startup" which is wrong because my program is not a service, it's an application with a user interface. Instead, I had to set the trigger to "At logon" and select MY windows user. It worked right away after that! – Nicolas C. – 2018-08-22T08:48:51.043

This worked for me without specifying a delay! For me a batch file is started that is a wrapper script for starting the "barrier" ethernet KVM client. With this solution I am able to control UAC elevated windows via the remote system as well - great! – Nicolas – 2019-06-04T11:22:25.453

4

Well why don't you simply copy the shortcut of the program to the Startup folder and on its properties, enable the administrator permissions on the Compatibility tab?

Surya Teja Karra

Posted 2015-06-17T18:54:30.873

Reputation: 139

1We have done that and my program still raises Access Denied error message. – ThN – 2015-06-19T18:54:25.703

did you right click the shortcut in the Startup folder and set it's permissions properly? The "Run as administrator" option is usually present in the Compatibility tab of the properties window – Surya Teja Karra – 2015-06-19T18:56:01.113

1You are right. First, we have enabled Run with highest privilege checkbox in the compatibility section for the shortcut. Then, clicked on the icon, it still popped the error message. Then, we moved the shortcut into startup folder, it still raised the error message. We even tried Task Scheduler and still the same. I even tried batch file in the task scheduler like someone suggested. it the same. The only time it loads normally is when we right click on the actual executable file for my program and click on Run as an Administrator option in the popup menu. The only user is the admin in sys – ThN – 2015-06-19T19:03:19.203

You know back in the days, XP had this "Run as" context menu with which I could run a program as another user had I got the authorization to do so. Maybe this program of yours needs the same thing :/ – Surya Teja Karra – 2015-06-19T19:06:18.307

1This doesn't work. – HolyAvengerOne – 2018-08-08T16:02:28.237

1

You can try double checking your Security tab in the Properties of the program/app and see if the users/groups all have "Full Control". Im not sure if that will fix but its worth a try

SillyBillyWTF

Posted 2015-06-17T18:54:30.873

Reputation: 11

1This doesn't work. – HolyAvengerOne – 2018-08-08T16:02:35.910