7zip Self Extracting Archive (SFX) without administrator privileges

I fixed this problem with mpursuit answer.

To update manifest of 7zS.sfx you can use the following procedure:

manifest.xml

   <?xml version="1.0" encoding="utf-8"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!--application support for Windows Vista -->
          <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
          <!--application support for Windows 7 -->
          <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
        </application>
      </compatibility>

      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
          </requestedPrivileges>
        </security>
      </trustInfo>

    </assembly>
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
mt.exe -manifest manifest.xml -outputresource:"7zS.sfx;#1"
copy /b 7zS.sfx + build.config + archive.7z sfx_archive.exe

Unfortunately I have not found a way to generate SFXs using 7zip that do not require admin privileges. Having tried some other SFX generators, I stopped at IExpress that has completely satisfied my needs.


You can embed a manifest file in the original 7zs.sfx that informs Windows to run the extractor with the same access token as the parent process. Which will cause the self extractor to run as a normal user if that is what the user is login as.

The following link describes how to embed a manifest file in an executable using Visual Studio 2005, but the same process applies in later versions. https://support.microsoft.com/kb/944276

Once you have embedded the manifest file that sets the "requestedExecutionLevel" to "asInvoker", any self extracting archieve created in the normal way with the modified 7sz.sfx will not require administrator privileges.


Put MiscFlags="4" in your config file. That should fix your problem.

It should look like this:

;!@Install@!UTF-8!
RunProgram="setup.exe"
GUIMode="1"
Path="%tmp%\\mytemp"
MiscFlags="4"
;!@InstallEnd@!