HOWTO: Package files for deployment to windows computers

PaulF
Meraki Employee

HOWTO: Package files for deployment to windows computers

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.

 

  1. Download NSIS from https://nsis.sourceforge.io/Main_Page
  2. Install. This show place a shortcut on your desktop
  3. Run. This should spawn a window like this:

 

PaulF_0-1620403210880.png

 

 

  1. 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
  2. Create a folder on your desktop (NSIS_Test_Project in this case) and move the files you need into it
  3. Create a file called FileInstaller.nsi in here using notepad (or a similar text editor)
  4. 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:

Screenshot 2021-05-07 at 12.03.42.png

 

 

  1. Click Compile NSI Scripts in the NSIS app
  2. You’ll be asked to load an NSI file

PaulF_2-1620403210884.png

 

 

  1. select the one we’ve just created: The screen will run through your script and identify any issue

PaulF_3-1620403210884.png

 

  1. You can click Test Installer to run through and text everything
  2. You’ll now have a new file that you can use with Meraki Systems Manager!

PaulF_4-1620403210885.png

 

3 REPLIES 3
Inderdeep
Kind of a big deal

Re: HOWTO: Package files for deployment to windows computers

@PaulF : Thanks for the sharing !

Regards
Inderdeep Singh
www.thenetworkdna.com ( Awarded by Cisco IT Blogs award 2020)
kYutobi
Kind of a big deal

Re: HOWTO: Package files for deployment to windows computers

This is awesome!!! Thanks.

PhilipDAth
Kind of a big deal

Re: HOWTO: Package files for deployment to windows computers

Wow!  Great tips!

 

I've used the 7zip self-extractor before, but this is much more sophisticated.

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.
Labels