Forcing an application to Admin from config file

Andrea Nagar picture Andrea Nagar · Feb 10, 2013 · Viewed 8k times · Source

Is there a way I can add a setting in the configuration file so that that application will always start as admin? Thanks a lot.

Answer

Mark Sowul picture Mark Sowul · Feb 10, 2013

Not from the config file, but in the .manifest.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
            </requestedPrivileges>
        </security>
    </trustInfo>
</assembly>

http://blogs.msdn.com/b/nikhiln/archive/2007/04/19/embed-a-manifest-to-make-an-application-elevate-in-vista.aspx