How to force a WPF application to run in Administrator mode

You need to add an app.manifest. Change the requestedExecutionLevel
from asInvoker to requireAdministrator. You can create a new manifest by using the add file dialog, change it to require administrator. Make sure that your project settings are set to use that manifest as well. This will allow you to simply double click the application and it will automatically prompt for elevation if it isn’t already.

See here for more documentation:

http://msdn.microsoft.com/en-us/library/bb756929.aspx

EDIT:
For what it’s worth, the article uses VS 2005 and using mt.exe to embed the manifest. if you are using Visual studio 2008+, this is built in. Simply open the properties of your Project, and on the “Application” tab you can select the manifest.

Leave a Comment