Running something on Windows startup with elevated privilege

6,329

Simple answer, you cannot.

This is a security violation. If this were possible, malware could invest itself easily on a target system. To prevent applications from running with administrative privileges, the methods you described that work are the only ways you can take. They require administrative privileges to setup which is the only way it can be prevented to make malicious programs to take over without the users consent.

If you somehow force a program to run with administrative privileges at startup through the startup folder (requires scripts and what not) it will trigger a UAC prompt.

Only the task schedule method can be used to do it without a UAC prompt. Of course, setting up the task requires UAC in the first place.

Share:
6,329

Related videos on Youtube

Basj
Author by

Basj

Love to work on R&D involving Python, maths, machine learning / deep learning, data science, product design, and MacGyver solutions to complex problems.

Updated on September 18, 2022

Comments

  • Basj
    Basj over 1 year

    To launch a .exe on Windows startup with administrator privileges, I know that:

    • the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run method is not good, because it will always display a prompt on each startup "Are you sure to ...",

    • the TaskScheduler method works,

    but:

    • what about adding a shortcut to the .exe in Startup folder of the Start menu?

    I've tried it, but it silently fails - the .exe doesn't start.

    I also tried to edit the properties of the shortcut: Compatibility tab > Run as admin, and also Settings for all users button, then Run as admin.

    Idem: it silently fails to start.

    Question 1: How to make a .exe with elevated privilege start on Windows startup with a shortcut in Startup folder?

    Question 2: Will this show a UAC prompt on each startup?

  • Basj
    Basj almost 7 years
    Thanks! good to know! So I won't use this "shortcut method" because it would do a UAC prompt on each startup. But still why does it silently fail for me, even without a prompt ?