How to get a program to run at startup or logon in Windows 8 - with Administrator privileges - exactly as though app icon was double-clicked?

1

2

I have a program - Macro Scheduler - which requires Administrator privileges in order for me to run certain macros I have created.

This requires running the application at startup in Administrator mode. The application already automatically runs at startup.

To my horror, when "Run as Administrator" is checked, the application still runs at startup, but as verified by this question, the user interface is not visible and (more to the point in my case), the tray icon is invisible, and worse yet, with the tray icon invisible, the application does not respond to my hotkeys.

When I simply double-click the application icon, with "Run as Administrator" checked in the Properties for the application, the tray icon loads and the application runs as desired.

I therefore played around with various possibilities in the Task Scheduler to run this program at startup, most notably:

  • Set the scheduled task to run the program with "Highest Privileges"
  • Set the scheduled task to run the program as Administrator
  • Set the scheduled task to run the program as SYSTEM
  • Set the scheduled task to run the program as the user I log in as normally
  • Set the scheduled task to run the program in parallel if an instance is already running
  • Set the scheduled task to wait 30 seconds after logon to run the application
  • Set the scheduled task to run the application at "any user logon", as well as at system startup

Unfortunately, none of the above options works. Whenever the application runs without administrator privileges, it starts just fine, displaying the icon in the tray and responding to hotkeys, but without running my macros that require Administrator privileges. And, whenever it runs with Administrator privileges, no tray icon appears and it does not respond to hotkeys.

Note, in regards to the above link, that I have User Account Control completely disabled.

What I would like seems fairly simple. I simply want to run this desired program with Administrator privileges at startup or logon exactly as though I double-click the application icon. Nothing more, nothing less.

Is this possible in Windows 8?

Dan Nissenbaum

Posted 2014-04-24T00:11:45.547

Reputation: 522

how did you disable the UAC? Moving the slider down, NO longer disabled UAC in Win 8.x to still allow the execution of the new Store Apps. – magicandre1981 – 2014-04-24T04:33:08.337

@magicandre1981 - Thanks, I didn't know that. I just moved the slider down. So, it seems that as you've noted, UAC is not, in fact, disabled. – Dan Nissenbaum – 2014-04-24T05:06:50.363

Answers

3

Allow me to chime in here - I support Macro Scheduler. This doesn't directly answer the Windows 8 question but more how best to execute your macro elevated.

My advise would be to not run Maco Scheduler as admin. Instead compile your macro to a .exe and then run THAT as admin. Unless you have created some custom dialogs your macro itself would not have a UI and can run elevated for the purpose intended. Either schedule it from windows task scheduler or set it to run on startup. Better that ONLY your macro that NEEDS admin access runs as admin rather than the entire Macro Scheduler developer environment.

MTettmar

Posted 2014-04-24T00:11:45.547

Reputation: 46

2P.s. If you don't have the version that allows you to compile you can achieve the same thing by running the macro via the command line and run THAT as admin, independently of macro scheduler itself. – MTettmar – 2014-04-24T07:47:36.617

Thanks Marcus! If I run the compiled macro (or a batch script) once at startup, will it respond to hotkeys throughout the lifetime of the Windows session? – Dan Nissenbaum – 2014-04-24T12:29:03.097

That depends on how you write your macro. First, for hotkeys, either let Windows do that for you, or it will have to monitor those itself. You can use a KEY_DOWN OnEvent handler to do that. See: http://help.mjtnet.com/article/10-exes-and-hotkeys

Second, for it to do this for the duration of the Windows session then clearly it will need to stay running. A simple infinite loop will achieve that. Or as mentioned just create a shortcut for your .exe and let Windows handle the hot keys - there's an option to assign a hot key in the shortcut.

– MTettmar – 2014-04-24T13:29:00.803