Randem Systems - Your Installation Specialist


Sign the Computer Lemon Law Bill to Help Protect Your Computer Investment

 
Home
Online Payments
Computer Repairs
Items For Sale
InnoScript
RSTools
Virus Problems
Products
Free Products, Code and Utilities
Support
Services
Service Related Topics
Contact Us
Marking Your EXE to Request To
Run As Administrator on Vista / Windows 7


    I have been all over the Internet and there is nothing that explicitly tells you how to mark your file to "Run As Administrator". Everyone uses the buzz words but no one states exactly how to do it, Especially for VB exe's. This should only be done as a last resort. Your app should normally NOT need administrator
privileges to run properly. If it does need admin prviledges you probably have coded something incorrectly.

    I will give you a quick lesson on how it can be done with a little work. Since VB handles resource information differently than other languages such a C++ you can forget about using VB's resource editor on the exe. In my procedure you will need the help of this program:

"Resource Hacker" by Angus Johnson http://www.angusj.com/resourcehacker/

    If your app doesn't need to run as an administrator this is a bother to the user since they will need to approve the application to run each time they run it.

The procedure is as follows:

1 - Open the exe in the Resource Hacker
2 - Go to Action->Add a New Resource
3 - Select any text file. It really doesn't matter for you are going to delete the information anyway. So choose a small one...
4 - Use the following entries to fill in the New Resource box

Resource Type - 24
Resource Name - 1
Resource Language - 3081

4 - Select your new resource from the list and Replace whatever is in the language (3081) with a copy the XML script (Below) then compile the script and save back to the original exe. That's It!!!. Your exe is now marked to request to run as administrator on Vista. You will know this worked by the shield that Vista places on your applications icons.

Don't forget to change the marker EXENAME in the XML script to the same name as the exe you are marking or it won't work!!!

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity version="1.0.0.0"
    processorArchitecture="X86"
    name="EXENAME"
    type="win32"/>
<description>elevate execution level</description>
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly>


Procedure Created, Verified and Tested
By Ralph James
Randem Systems, Inc
August 02, 2007

ALL SUPPORT IS VIA THE SUPPORT BOARD.

http://www.randem.com/cgi-bin/discus/discus.cgi