I have an .exe that I want people to be able to download and run on Vista. It needs to run as admin. I have a web page with a 'Download' button. Assume I am logged in as an admin. I click the 'Download' button and IE8 asks whether to Run or Save. I choose 'Run'. The program is downloaded and started by IE 8. But it does not start as admin or ask the user if it's OK to run as admin. What do I need to do to make it ask?

I'm not looking for a workaround for a clever user. I do not want the user to have to do anything unusual such as save the file and then right click "run as admin", or make a shortcut and edit its properties, or turn off UAC, or run IE as admin, or do anything else other than be logged in as an admin and confirm that it's OK for the .exe to run as admin.

Thank you.

Dani AI

Generated

Short answer: this is by design — Internet Explorer on Vista runs tab processes in Protected Mode (low integrity) and Windows decides whether to show a UAC elevation prompt when a new process is created. If the downloaded EXE does not request elevation (no embedded manifest) and Windows’ installer-detection heuristics don’t flag it, the EXE will be launched without asking for elevation when you click Run. (learn.microsoft.com)

What to do if you want the Run -> UAC prompt behavior

  1. Embed an application manifest that requests elevation. The OS inspects the embedded manifest at process creation and will show the UAC consent/credential dialog if the manifest asks for requireAdministrator. A manifest is the reliable, supported way to force the system to prompt. Example manifest fragment (embed this in the EXE resources or alongside the binary):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

The manifest approach overrides installer heuristics and is the recommended method. (learn.microsoft.com)

Other practical notes

  • Installer heuristics (filename, version-resource strings, byte patterns) can also trigger elevation if no manifest exists, but that behavior is heuristic and fragile — do not rely on it for consistent results. (learn.microsoft.com)
  • Digitally signing the EXE (preferably with an EV code-signing cert) doesn’t force elevation, but it makes the UAC dialog show a “Verified publisher” and improves user trust. (learn.microsoft.com)
  • Do not advise users to run IE elevated to “fix” this — running the browser elevated defeats Protected Mode and increases risk.

Final note: pointed you toward the right MSDN material; ’s decision to remove the need for admin is the safest route when it’s possible. If forcing UAC from the Run dialog is required, add the manifest and sign the binary.

Recommended Answers

All 2 Replies

What language did you use to write that program? In C and C++ there are a few win32 api function calls you need to make in order to make the program run with admin privileges. See this article and the links at the bottom.

What language did you use to write that program? In C and C++ there are a few win32 api function calls you need to make in order to make the program run with admin privileges. See this article and the links at the bottom.

Thank you, Anceint Dragon. That's a useful link. Looking at it and the specific privileges in its link led me to look at exactly why my program needed to run as admin. I was then able to change the code to remove the need for admin privileges.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.