How to automatically run an elevated program shortcut at Windows startup, without login or UAC prompts

Posted by Paul Braren on Nov 10 2016 (updated on Nov 14 2016) in
  • Windows
  • Productivity
  • Backstory

    Why did I want to do this? Well, I was setting up to record this one-long-shot 4K test video, where I wanted my Window Server 2016 test system to automatically go right into maximum CPU and RAM abuse mode, without requiring a keyboard or monitor. A little strange, I know, and certainly a corner case. That said, the little tricks featured in this intermediate-skills article can be applied to many other use cases too.

    So the first hurtle I had to clear was to grab the new 64 bit version of the simple, oldie-but-goodie Prime 95 that bangs away at all CPU cores and RAM. But alas, the dang thing also invokes that UAC prompt. Requires it actually. What to do? How about a mashup of three techniques:

    1. get past the UAC (User Access Control) prompt
    2. automatically login at boot and avoid that password prompt
    3. set that special shortcut to auto-start

    This is one of those articles I'm writing both for you and for my future self, because I know I'll be using these techniques again.

    Warning

    This technique is done at your own risk, see also the usual disclaimer found with every article.

    Not that this article doesn't suggest disabling UAC is a good idea, even if it is admittedly simpler than this work-around which only creates a single exception to the usual UAC prompt. It may be more helpful for the Windows Server family of operating systems.

    I realize that setting Windows to automatically log you in is not exactly a great idea from a security perspective, but remember, I said test system. This is a private, temporary, isolated home-lab. I'm using the free 180 trial of Windows Server 2016. This auto-login behavior requires an encrypted, saved password. It's also handy for test VMs as well, including reboot time on SSD tests.

    Prerequisites

    • an executable that requires elevated rights, and you want to run it unattended, automatically, at system reboot, and be able to interact with it
    • knowledge of your username and password, with admin rights
    • Windows 7
    • Windows 8 / 8.1
    • Windows 10, including latest Anniversary Edition
    • Windows Server 2012
    • Windows Server 2016
    • if you don't mind external downloads or third party software, per James Senecal's suggestion below, you may find it simpler to use the portable RunAsTool by Sordum as a substitute for the Task Scheduler first step below

    Instructions

    1. Create the special shortcut using Task Scheduler

      by following along with this excellent set of instructions:

      Windows-TenForums

      How to Create an Elevated Program Shortcut without a UAC Prompt in Windows
      Jul 28 2016 by Shawn Brink at Windows TenForums
      For my use, as demonstrated in the video below, I only had to make the following minor tweak to the essentially identical Windows 7 version of the same procedure:
      a. paste the following line line of code into the Actions tab, with -t being a Prime95.exe unattended test startup option (your optional startup parameters will vary):

      %windir%\System32\cmd.exe /c start "Prime95" "C:\util\prime95.exe" -t

      When you're done creating and testing your special desktop shortcut, run it to test that it works, then continue with these instructions.

      shell-common-startup
    2. Open your Startup folder

      a. click the Start menu
      b. type Win + R, brings up Run dialogue
      c. press Del key, to delete whatever was there
      d. paste the following one-liner into the Run dialogue:

      shell:common startup

      then press Enter
      d. Windows Explorer opens right up, to the special Startup Folder

    3. Move the special shortcut to your Startup folder

      that you created in step 1 to this special folder, using drag-and-drop

    4. Launch User Accounts

      it's built-in to Windows, and it saves your credentials, so Windows no longer prompts you for a password after reboot, here's how to set it up:
      a. click the Start menu
      b. type Win + R, brings up Run dialogue
      c. press Del key, to delete whatever was there
      d. paste the following one-liner into the Run dialogue:

      netplwiz.exe

      then press Enter

    5. Use User Accounts to configure automatic login

      on netplwiz's Users tab, Uncheck:
      Users must enter a user name and password to use this computer.
      then click OK, you'll now be prompted to enter admin credentials, then press Enter

      UserAccounts-uncheck-users-must
    6. Reboot to test

      watch what happens after rebooting

    Tada, you're done! Your special shortcut automatically runs your program shortcut as Administrator after that reboot, without the User access Control pop-up. Nice!

    Have a problem following along with these written instructions? Worry not, my detailed, step-by-step video below should help.

    Video Instructions

    How to automatically run an elevated program shortcut at Windows startup, without login/UAC prompts

    Nov 11 2016 Update

    The comments have been very helpful already! One example is Gareth Cooper's YouTube comment:

    Very useful! If you want a quick way to copy the path of a file press Ctrl-Shift and Right-Click on the file and choose "Copy as Path".


    See also at TinkerTry


    See also