1

I have an executable file that I want to run automatically and restart if it dies for some reason.

However, when I try to run the .exe, I am prompted with an

Open File - Security Warning

that requires me to either select "Run" or "Cancel".
However, when I run this .exe as a scheduled task, it runs fine, so it appears that there is some way to run it without any user selection.

How can I make this happen?
I'm doing the coding in C#, but am not confident that it's an issue that can be solved with just C#.
Any help would be great.

zx485
  • 28,498
  • 28
  • 50
  • 59
Sean Smyth
  • 1,509
  • 3
  • 25
  • 43
  • 1
    This appears to be sourced by Explorer.exe launching the process. You can globally disable the warning (instructions [here](http://stackoverflow.com/questions/2638862/security-warning-when-opening-file-from-network-share)). I found some info [here](http://stackoverflow.com/questions/941656/open-file-security-warning). The point is that you can't do it locally from the exe itself, apparently Explorer is maintaining information about your file somewhere else and using that to pop up the dialog, so you can either disable the warning globally, or launch without Explorer (such as scheduled task). – Quantic Dec 21 '16 at 23:49
  • 2
    So, the executable requires elevated permissions and you don't have access to the source to fix the problem? I'd write a watchdog process that runs with elevated permissions. Processes that are started from an already elevated process will be started with that same elevated permission thereby not requiring the user to interact with the UAC dialog. To start your watchdog app with elevated permissions, add a manifest that requires it. See http://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator for more details. – spender Dec 21 '16 at 23:56
  • 2
    If your exe is on a Network drive, refer to [security-warning-when-opening-file-from-network-share](http://stackoverflow.com/questions/2638862/security-warning-when-opening-file-from-network-share) – Graffito Dec 22 '16 at 00:36
  • @Graffito Yep, that fixed it. Thanks! – Sean Smyth Dec 22 '16 at 00:43

0 Answers0