Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?
C# – How to force the .NET application to run as administrator
administratorcelevated-privilegesnetwindows 7
Related Topic
- C# – How to enumerate an enum
- C# – How to create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- .net – Difference between decimal, float and double in .NET
- C# – How to get the application’s path in a .NET console application
- C# – a NullReferenceException, and how to fix it
- C# – How to turn a C# object into a JSON string in .NET
- Powershell – Running a command as Administrator using PowerShell
Best Answer
You'll want to modify the manifest that gets embedded in the program. This works on Visual Studio 2008 and higher: Project + Add New Item, select "Application Manifest File". Change the
<requestedExecutionLevel>
element to:The user gets the UAC prompt when they start the program. Use wisely; their patience can wear out quickly.