How to run a program with administrator privileges on user login under Windows?

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 or C:\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?


Solution 1:

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.