I have a windows form application that need of the admin permission for running, to make this, I use this code:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
The next step for complete the development is that this windows form application start up after windows restart, turn off and turn on again or user logon.
Here is my problem, this application need administrator permission and need startup after system startup, but I don't know to make this.
things did I do:
Put the application executable path on regedit
Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
I Did create Windows Services project
These options do not work, can someone help me?
Thank you.
I find the answer for run a application with admin permission at startup.
Basically I just created a task with run level Highest and your trigger is on Logon.
I found the code in vb in this repository: https://bitbucket.org/trparky/start_program_at_startup_without_uac
So all I did was translated this code to c# and make tests
I'm using regedit.exe on exemple because this program required admin permission for run.
Create the task, make logoff and login again and you will see the regedit open after logon.
OBS: To create or delete task you have run visual studio as administrator, or put this code in the install process of your program
Let me know if this worked for someone