Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Program as Administrator in vb.net

Tags:

vb.net

I am programming with vb.net . I have a program which needs Administrator Privileges

I want: If program started then a Prompt Show (UAC(User Account Control)) shows that it have to tun as administrator. Is it possible?

like image 723
user3024698 Avatar asked Nov 23 '13 18:11

user3024698


People also ask

How do I run a VB program?

There are several ways to run your program: Press the F5 key. On the VB menu bar, Run > Start. On the VB toolbar, click the VB Run icon (the arrow)

How do I run Visual Studio with admin rights?

Run Visual Studio as an administratorOpen the Start menu, and scroll to Visual Studio. From the right-click or context menu of Visual Studio 2019 or Visual Studio 2022, select More > Run as administrator. When Visual Studio starts, (Administrator) appears after the product name in the title bar.

What is run as administration?

Summary. You can use Run as to start an application as an administrator if you want to perform administrative tasks when you are logged on as a member of another group, such as the Users or Power Users group.


2 Answers

You can do the following to make sure the program has admin permissions:

You can edit the UAC Settings (in VB 2008), which is located in the Project Settings. Look for the line that says

Change level="asInvoker" to:

level="asInvoker" (normal account - default)

level="requireAdministrator (require administrator - What you need... but could be next one)

level="highestAvailable" (if anything is higher then administrator, require that)

Hope it helps :)

-nfell2009

like image 162
BaeFell Avatar answered Sep 30 '22 20:09

BaeFell


None of the project settings suggestions worked for me in Windows 10 64 bit. I changed to Release, I replaced "asInvoker" line with "requireAdministrator" line and still was getting Access Denied Exceptions. The only way to run thru VS2013 is to run the environment off the bat AS AN ADMINISTRATOR.

like image 36
user2562950 Avatar answered Sep 30 '22 20:09

user2562950