How To Make A VB.NET Application Always Run In Administrator Mode?

Today, we are going to share a useful piece of code which will help many people who are searching here and there for some code which allows their VB.NET application to always run in adminstrator mode. By default, applications always run in standard user mode. However, they can be run in Administrator mode by Right Clicking The EXE File-> Run As Administrator.

But some applications require the ownership of some registry key or some system file or folder. This requires application to always run in administrator mode to work. But what to do so that the application starts in Adminstrator mode by default. Manifest file is the answer.

Manifest file is a file in VB project which contains the information about the contents of file distribution. It may contain checksum or hash to verify that file is original and isn’t modified in any way. Modifying a file will change its checksum value.

Tutorial:-

1. Open VB.NET project and click Project -> Add New Item

2. A following type of dialog box will open. Select “Application Manifest File” and click Add.

 3. Open this manifest file. Look for the code as highlighted in following image:

4. Replace asInvoker with requireAdministrator or highestAvailable and you’re done! Both ways will work.

This will make the application run with highest available privileges. If you still have some doubt or problem, you can ask in comments!

Join Us On Facebook and Twitter and you can subscribe via email too4

Related posts