Hi.
Whilst packaging files and script (and even plists) is relatively trivial on the Mac (you can even do it from the command line with pkgbuild), things aren't as easy for Windows
Because of this, I've put together a guide on how to package scripts, files, .exe and .bat files, and even run one of the files after install, so that you can completely provision your windows devices:
There’s many ways to create an installer for windows that performs functions above and beyond what a ready packaged installer will do. For example, reading and setting registry entries, placing files in various places, running batch files, etc. Whilst there’s plenty of commercial applications to do this, I’ve used a app called NSIS to show what can be achieved
Steps.
- Download NSIS from https://nsis.sourceforge.io/Main_Page
- Install. This show place a shortcut on your desktop
- Run. This should spawn a window like this:
- For the basis of this demo, we are going to put some files into a folder on the current users desktop and execute one of them
- Create a folder on your desktop (NSIS_Test_Project in this case) and move the files you need into it
- Create a file called FileInstaller.nsi in here using notepad (or a similar text editor)
- Drop in the following text
OutFile “AcmeInstaller.exe”
InstallDir $Desktop\AcmeFiles
Section
SetOutPath $INSTDIR
File AcmeIncConfigData.json
File catchyCorpJingle.wav
File customerInformation.csv
File font1.font
File readme.txt
File runme.bat
File runme.exe
SectionEnd
Section
nsExec::Exec $DESKTOP\AcmeFiles\runme.bat
SectionEnd
Save
Notes:
AcmeInstaller.exe : the name of the file you’re going to create with the app
$Desktop is a variable which will have the correct path for the currently logged in user, to the Desktop
$Desktop\AcmeFiles : A folder on the users Desktop where we will install the files
$INSTDIR The above folder, $Desktop\AcmeFiles
$DESKTOP\AcmeFiles\runme.bat : The bat file that we will run as part of the installer process. This could be an msi, exe, bat or even cmd. Having a bat file means that you can have complex logic being used
I've used the Desktop as it's a useful place (and easy) to spot that the files are being installed and executed correctly: For production, I'd use somewhere that's available whether the user is logged in or not: /tmp for transitory files, Program Files, or somewhere more convenient for you
You should now have:
- Click Compile NSI Scripts in the NSIS app
- You’ll be asked to load an NSI file
- select the one we’ve just created: The screen will run through your script and identify any issue
- You can click Test Installer to run through and text everything
- You’ll now have a new file that you can use with Meraki Systems Manager!