Search code examples
windows-7exceluacelevated-privilegesvba

How to run a program as elevated in Windows 7?


I created an application in Excel VBA that needs to run a batch file out of script and I was wondering how I can elevate all the processes that the process creates. Please I need to know how to elevate processes?


Solution

  • If you have an EXE, you can embed a manifest it that will make it require adminrights on Windows 7/Vista.

    Edit: The entire that does this manifest would be:

     <?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="highestAvailable" uiAccess="False" />
            </requestedPrivileges>
         </security>
        </trustInfo>
      </assembly>