Preparation
Grab:
7zip – https://www.7-zip.org/download.html
LZMA SDK – https://www.7-zip.org/sdk.html
UniExtract2 – https://github.com/Bioruebe/UniExtract2?tab=readme-ov-file
SNMPTester – https://www.paessler.com/tools/snmptester
MT.exe – https://github.com/jvincke/mt/blob/master/x64/mt.exe
Install 7zip
Create SNMP Tester portable
Extract Paessler SNMP Tester.zip to c:\install\
Extract UniExtract2 to c:\install
Run UniExtractUpdater_NoAdmin.exe and allow it to update
Run UniExtract.exe
Select Next, Next, Finished in the wizard to skip initial setup.
Select Archive/Installer to extract
Select the “c:\install\Paessler SNMP Tester Setup.exe” file
Select the destination directory as “C:\install\Paessler SNMP Tester Setup”
The SNMP Tester files will be extracted to that directory.
If you receive a message that UniExtract is not compatible with the version of installer, try updating UniExtract.
Create the archive
Select all the files in the SNMP Tester Extracted directory, and create a 7z archive in the c:\install directory. Name the file snmptest.7z. Ensure that the snmptest.exe file is the root of the 7z archive, not a subdirectory.
Create the executable
Extract the 7zSD.sfx file from the LZMA SDK \ bin directory to c:\install
Copy the mt.exe file to c:\install
Prepare a manifest to prevent needing to runas admin
Create c:\install\SNMPTester.manifest containing:
<?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>
Prepare the command to run after extract
Create c:\install\config.txt file containing:
;!@Install@!UTF-8! Title="SNMP Tester" RunProgram="snmptest.exe" ;!@InstallEnd@!
You should have a number of files in c:\install
Apply the manifest
Open a command prompt, navigate to c:\install and run the following command
mt.exe -manifest "SNMPTester.manifest" -outputresource:"7zSD.sfx;#1"
Create the executable
copy /b 7zSD.sfx + config.txt + SNMPTest.7z SNMPTester.exe
That will output a self extracting archive (c:\install\SNMPTester.exe) that runs snmptest.exe and remove the temp files upon completion.
You can move c:\install\SNMPTester.exe to where it is needed and remove all files in c:\install
References:
https://superuser.com/questions/42788/is-it-possible-to-execute-a-file-after-extraction-from-a-7-zip-self-extracting-a
https://superuser.com/questions/730242/7zip-self-extracting-executables-require-admin-privileges-and-trigger-compatib