How can I run a program with Administrator permissions on startup, and minimize to tray?

4

2

I like to keep Process Explorer running full-time. I particularly like to use it to display several statistics (e.g.: Usage graphs for CPU, RAM, Network, GPU) in the system tray. However, some of these tray icons (as well as other Process Explorer functions I like having handy) require Administrator permissions to run.

I've tried setting Process Explorer to run as Administrator on startup, and minimize to the system tray, by configuring the following:

  • In Process Explorer
    • Hide When Minimized
    • Allow Only One Instance

  • Shortcut in Start Menu -> Programs -> Startup
    • Run: Minimized
    • Advanced: Run as Administrator

However, this causes one of the following:

  • Process Explorer won't run on startup.
  • Process Explorer will run on startup, but will require UAC response.
  • Process Explorer will run on startup without UAC prompt, but without Administrator permissions.

My ideal solution would result in:

  • Process Explorer runs on startup, with Administrator permissions.
  • UAC response is not required to run Process Explorer on startup.
  • On startup, Process Explorer will be minimized to the system tray.
  • UAC can remain set at "Always Notify" and "Prompt for Credentials".
  • No additional software installations required.

Is this possible?

Iszi

Posted 2013-03-28T18:24:45.677

Reputation: 11 686

Have you tried the task scheduler? That should let you run it as administrator I'm not sure about minimised. – Col – 2013-03-28T18:54:14.790

@Col I have not tried Task Scheduler yet. If you have a process for configuring Task Scheduler in such a way that it meets the goals I've laid out in the question, please post it as an answer. – Iszi – 2013-03-28T19:07:42.450

I think what you really want is a performance monitor...? – Austin T French – 2013-03-28T19:25:46.140

@AthomSfere Not really. The features I've mentioned in Process Explorer are sufficient for my interests right now, plus keeping it in the system tray makes it quickly accessible without actually making it the replacement for Task Manager. – Iszi – 2013-03-28T19:29:08.253

Answers

2

You can create a task in the Windows Task Scheduler where you run the procexp.exe command and make sure to check the "Run with highest privileges" on the general tab to run it in admin mode. On the trigger tab you should define the task to run "At log on".

This will run the command with admin privileges at startup without asking for UAC verification.

To make sure Process Explorer starts minimized to the tray you should use the /t command line switch as an argument for the command when you add it to the action tab of the scheduled task.

Per Salmi

Posted 2013-03-28T18:24:45.677

Reputation: 749

Slami I did do exactly what you have said, but my application runs as a background process ONLY. I want my program to run as an application. – ThN – 2015-06-17T20:36:21.697

"you should use the /t command line switch" Could you give an example of that? Would it be like this, with /t replacing /c? /t start "Taskmgr" "C:\Windows\System32\Taskmgr.exe" – cellepo – 2016-01-10T21:56:12.533

0

This is more details for the essence of the Answer by @Per Salmi, in this separate Answer as it would be too much for a comment on his Answer...

  • Follow Elevated Program Shortcut without UAC Prompt
  • That satisfies all of the requirements from this Question except, "On startup, Process Explorer will be minimized to the system tray"
    • I'm not sure if that didn't work just in the special case of my attempt with Task Manager (Taskmgr.exe) instead of Process Explorer, as observed in 5. here as well, where maybe it might work with other programs instead...
      • Would love to hear if someone comes up with a solution for this part for Task Manager specifically!
      • A workaround inside Task Manager: Options -> Hide when minimized. Then on startup, minimizing it once gives the desired tray minimization. Of course it'd be nice for the minimization to be auto, but that's why this is a workaround.

cellepo

Posted 2013-03-28T18:24:45.677

Reputation: 153

0

I do something similar:

  • Shortcut in Start Menu → Programs → Startup
    • To: SCRIPT1.BAT


  • SCRIPT1.BAT
    FRED /c SCRIPT2.BAT


  • FRED.EXE
    • Is a copy of CMD.EXE
    • Compatibility: Run this program as an administrator


  • SCRIPT2.BAT
    • runs command(s) as administrator, with no system dialog

All files (FRED.EXE, SCRIPT1.BAT, and SCRIPT2.BAT) are in (a bin subdirectory of) my home directory.

Now as a matter of fact I choose to have my windows visible –– I want to see the results of the commands.  But I presume that I could use “Run: Minimized” and maybe START /MIN to keep things off the screen (in the taskbar).

I don’t remember why I did it as a two-stage process, but I probably played with it for several days before I could get it to work correctly.  If you figure out a way to streamline it, please post it.

Scott

Posted 2013-03-28T18:24:45.677

Reputation: 17 653

And there's no UAC window? Have you disabled UAC? – Jet – 2014-04-25T13:46:04.337