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


To totally unlock this section you need to Log-in


Login

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:

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

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

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

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

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

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

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

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

1 thought on “Make A VB.NET Application Always Run In Administrator Mode?”

  1. Sometimes, during a lonely night while programming, you realize that your new software will need administrative privileges to properly run….so, how to force OS to run it as administrator on Windows systems?

    Read more on HeelpBook:

    Make A VB.NET Application Always Run In Administrator Mode? -http://heelpbook.altervista.org/2014/make-a-vb-net-application-always-run-in-administrator-mode/ – read more on HeelpBook! #howto #vbnet #heelpbook

Comments are closed.