I can't find a C# library to use startInfo.Verb="runas"
. Please tell me where I can find it.
using ???;
...
startInfo.Verb="runas";
I can't find a C# library to use startInfo.Verb="runas"
. Please tell me where I can find it.
using ???;
...
startInfo.Verb="runas";
In order to run your application only with administrator permissions, first of all, you should add manifest file to your application.
You can do it in VS 'Add -> New Item -> Applicatoin Manifest File'.
Then find this line on it:
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
Then change level attribute value to requireAdministrator
.
After all you need is to include your manifest in PE-exe resources.
In manifest properties change Build Action item to Embedded Resource.
This procedure worked for me.
You can find more details about manifest here.
UPDATE
I did not find a way to make this programmatically.
People guess there is no way for application to level upo its own permissions programmatically,
Please, read attentively comments for latest answers here
I am not 100% sure, but i think the documentation of what your looking for is on the Microsoft website, here
I think you should include these as well
using System;
using System.Diagnostics;
using System.ComponentModel;