0

I would like to set the "Run this program as an Administrator" Checkbox option enabled by default. So that it does not require user to Right click on exe and select Run As administrator every time.

  1. While building the exe in .Net Application, is there any way to enable this option programmatically?
  2. While Creating MSI installer, is it possible to set this checkbox enable?

Steps to Manually Enable Option

  1. Right click on C# EXE
  2. Select Properties
  3. Go to compatibility tab
  4. Choose Run this program as an Administrator Checkbox

Refer the attached Image

Image of C# Exe Properties

Rajanbabu
  • 1
  • 2

1 Answers1

2

I suppose you can write or generate Application Manifest file with option "requestedExecutionLevel" and value "requireAdministrator".

See https://learn.microsoft.com/en-us/previous-versions/bb756929(v=msdn.10)?redirectedfrom=MSDN for more details.

SLenik
  • 815
  • 1
  • 8
  • 15
  • Is this setting always run application As Administrator(similar to right click on exe and select Run As Administrator) – Rajanbabu Apr 11 '23 at 11:39