0

i build a windows form setup application(.exe) and forced that run as administrator.

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

i want to auto run this app when windows was booted. To do this I added the following code to my program.

RegistryKey autoRun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
autoRun.SetValue("my app name", Application.ExecutablePath.ToString());

now my problam is when i remove limit of run as administrator, my app auto run when windows was booted. but when my app forced to run as administrator, my app con't auto run. how can i solved this problam? thanks.

  • https://superuser.com/questions/929225/how-to-run-a-program-as-an-administrator-at-startup-on-windows-10 – Nisd Feb 24 '22 at 08:32
  • Use Windows Scheduler to set up the task which will run on logon/boot. Sample .NET wrapper: https://github.com/dahall/TaskScheduler/wiki/TaskSecurity – Toumash Feb 24 '22 at 08:32

0 Answers0