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?
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)
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With