Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#.NET: Acquire administrator rights?

Is it possible in a C#.NET application to request administrative rights on a Windows 7 PC?

I want to be able to deploy the application via Click Once and have users use it to perform administrative tasks (in this case it is writing registry entries for the main application).

like image 375
Turing Complete Avatar asked Aug 27 '10 11:08

Turing Complete


2 Answers

http://victorhurdugaci.com/using-uac-with-c-part-1

http://victorhurdugaci.com/using-uac-with-c-part-2

http://victorhurdugaci.com/using-uac-with-c-part-3

*self promotion

Extra characters because it must be 30

like image 76
Victor Hurdugaci Avatar answered Oct 10 '22 02:10

Victor Hurdugaci


simply all what you need to do is to add manifest application file to your project

simple : right click on the project , add , new item , manifest file


and Change the

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

to

 <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
like image 43
Bilal Avatar answered Oct 10 '22 02:10

Bilal