Distributing files with your packaged scripts
- Written by Alexander Riedel
- Last Updated: 07 April 2016
- Created: 22 March 2016
- Hits: 6154
We get this question every week: Why can I not include my data files, secondary scripts, modules, other executables etc. with the packaged executable and have it unpack them when I run it?
If you have been a SAPIEN customer for a few years you may remember that we had this feature in the packager until the 2012 version. The predominant operating system at the time was Windows XP and this worked fine. With the advent of Windows Vista and Windows 7 we received this question more and more: “Why does my packaged script no longer work?. You need to fix this!”
Basically with the shift in the dominant operating system additional security measures came into play. An application running from the program files folder can no longer just willy-nilly create files there. It just fails. So all that extracting does not work. You need elevation to do that and we know that you should “usually” run your applications under a normal user account.
Secondly, many virus and malware detectors became very good at detecting executables that generate secondary executable files, so extracting scripts, dlls, exes and so forth can result in your files being quarantined and your solution will not work. So even if you installed your solution outside of the protected “Program Files” folder, thus circumventing a Windows security measure, you still may have trouble getting this to work.
Sure, you can always run elevated and add exceptions to your anti-virus and malware software for your solutions. That is fine on one computer, but what if you need to do this on all machines in multiple networks? Will your clients or employers allow you to open these doors and security risks just to run that one script you need? Usually not.
So we added a simple way to create an MSI Installer for your script applications. Wrap your files including the packaged executable into a Windows Installer file (MSI) and unpack your files once during install, which usually happens elevated. This also adds the ability for the user to see your installed solution in “Programs and Features” and the version number, which makes things easier when you need to find out what a customer has installed.
If for some reason you really, really despise MSI files or installing software is not allowed on a server (Simply copying files is ok?), create a zip file and unpack it at the destination. Once.