How to run a program with administrator privileges on user login under Windows?
The best way (and the only simple way if you not only want this to run as admin but also without an UAC prompt) to do this is by creating a scheduled task. There you can specify which user you want to run it under but also that it should "run with highest privileges". This is probably what you really want because the checkbox button "Run as administrator" does trigger a UAC prompt rather than really using an administrative user. If you also specify a trigger as "on user logon" it should have the same effect as using the startup or run key.
Alternatively you can use runas with the /savecred option to store the password of another user once and have it cached forever but it does not work around UAC afaik.
Related videos on Youtube
Frederick Zhang
Updated on September 18, 2022Comments
-
Frederick Zhang over 1 year
I'm using Windows 8.1 x64 and I'd like to run a program with administrator privileges on user login.
I tried to make a shortcut of the program and ticked "run as administrator" in the properties of the shortcut or the program itself, and put the shortcut in
C:\Users\MyUser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
orC:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
, but ticking the box just made it invalid.Then I edited the program by Resource Hacker to modify its manifest so that administrator privileges were required for this program. This also made shortcuts under start up directories invalid. So after this, I tried to add the program to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
but it didn't work, either.How on earth can I run a program with administrator privileges on user login?
-
Frederick Zhang almost 9 years@Ramhound You meant write a batch whose content is
runas /env /user:domain\Administrator X:\path\to\the\program.exe
and put it in the auto start up directory? -
Frederick Zhang almost 9 years@Ramhound But this command will prompt for the password which I don't want it to.
-
Ramhound almost 9 yearsYou can use
runas
, and save the Administrator credentials, although that poses a security risk for obvious reasons. You are 100% this program required administrator permission to work properly?
-
-
Frederick Zhang almost 9 yearsI tried task scheduler at first as well but it made the tray icon of the program missing. But I reviewed the configurations of the task just now and found a combo box named
Configure for
whose default value was Vista/2008. Then I switched it to Windows 8.1 and everything's ok now. Thanks.