Friday, October 03, 2014

Configure app which requires admin rights to run at startup with task scheduler

 

App which requires elevated admin rights can’t just be set to run at startup by adding it to the registry key (HKLM\Software\Microsoft\Windows\CurrentVersion\Run) because it mail fail to start since it requires the UAC prompt. Windows will silently fail to display the UAC prompt.

One solution is to make the app a Windows Service, but depending on the technology used, this might not be possible. For example, a .NET Windows Service which is using .NET API printing (System.Printing) is not recommended (see http://blogs.msdn.com/b/dsui_team/archive/2013/06/24/printing-from-a-windows-service.aspx or see ‘Caution’ in http://msdn.microsoft.com/en-us/library/system.drawing.aspx).

So another solution is to use task scheduler.

When configuring the scheduled task, you need to make sure:

1. In the task properties popup, "Run with highest privileges" option is checked.

2. In the "Edit Action" popup, "Start in" is filled with the directory path (Do not include quotation marks or a trailing slash)

http://social.technet.microsoft.com/Forums/windows/en-US/7167bb31-f375-4f77-b430-0339092e16b9/how-does-run-with-the-highest-privileges-really-work-in-task-scheduler-?forum=w7itprogeneral