Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Run as Administrator" - HOWTO

Status
Not open for further replies.

IlyaRabyy

Programmer
Nov 9, 2010
568
US
Colleagues,
I needed to to test my Program in IDE, that is to run (in Debug mode), a program as Admin. (You'll need it if your program deals with System files, e.g. logs, that requires Admin rights.)
The VS's (2022 in my case) DevEnv.EXE has such option, I checked.
You need to find this EXE, e.g. C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe, right-click on EXE and select "Run as Administrator" - and "yer in business!" You now can Debug as Admin! [wink]

HTH.


Regards,

Ilya
 
[tt]Project -> <yourappname> Properties -> Application -> General -> Create or open App manifest for Windows settings
[/tt]
Modify the requestedPrivileges section as appropriate, in this case

[tt] <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />[/tt]

e.g

appmanifest_srulvr.png
 
Those warnings are nothing to do with running as administrator. Why have you posted them in this thread?
 
StrongM said:
Why have you posted them in this thread?

1st, the code is in VB .NET.
2nd, where else? (Tried some other Forums couple times - dinna like it. Answers were either not on topic, or just references on the Help chapters which I've already read and found non-helpful.)

On the footnote: I worked in dBase/FoxBase/FoxPro/VFP since 1990 till 2019 (and in VB6/VB .NET as secondary platforms). There was this VFP Forum (Foxite, IMS) I was very active member of for 15+ years. This Forum was ultra-helpful! The only Forum on VB .NET I could find that is close to that one in helpfulness (if that's a word) is this one.

Regards,

Ilya
 
>1st, the code is in VB .NET.
I kn owq. It's MY code. I'm not suggesting not to post in the VB/NET forum, I'm talking about what is the appropriate thread in the forum

My point being, Ilya, that you appear to have posted a completely unconnected picture demonstrating an issue that is NOTHING to do with running with "Run as Administrator - HOWTO", which is what THIS thread is about.

The picture is related to thread1867-1829394 - where you have already posted it!
 
This week has been hectic, I was torn in all 5 directions (especially in the 5th one, time)...
Apologies for posting the wrong screenshot in the wrong thread!

Regards,

Ilya
 
The suggested adjustment in the App.EXE.manifest file,

<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--
UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="[highlight #FCE94F]requireAdministrator"[/highlight] uiAccess="false" />
</requestedPrivileges>

didn't work as expected:
2024-03-28_App_Manifest_As_Admin_Erred_ny67eg.jpg


Apparently, just changing the App.exe.manifest is not enough...
What else, sans being an Admin (which typical End User is not), is required?

Regards,

Ilya
 
No, that is exactly right, if the IDE is not already running as admin (which, in general, it should not be). Click restart and it will (temporarily) elevate the IDE via a UAC. It will also give a UAC prompt if you compile and run it. This is the behaviour we want. Honest.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top