packaging with Inno setup with Application Packaging

packaging Inno setup – As an IT professional, deploying tools built with PowerShell scripts is a common task. These tools might include:

packaging Inno setup – As an IT professional, deploying tools built with PowerShell scripts is a common task. These tools might include:

  • Installing printers with SNMP queries to identify the model.
  • Displaying PC information.
  • Creating a technical menu for accessing Windows 10 functions with admin prompts on locked machines.

packaging Inno setup – Since these scripts often change versions, it’s crucial to track the installed versions. This tutorial outlines the method I use to achieve this.

Converting PS1 to EXE

packaging Inno setup – The first step is to convert the PowerShell script (.ps1) to an executable (.exe). Managing an executable is much simpler than dealing with a PowerShell script on a user’s machine. For this, I use ps2exe GUI, a well-known tool.

packaging Inno setup – If you have inventory tools (LANDESK, SCCM, KACE, etc.), you can include version information and product name details. Pay attention to these two options in ps2exe:

  • Compile a graphic window program: Uncheck this option to see messages like write-host.
  • Require administrator rights: This option is useful for tools dedicated to administrators, allowing an authentication prompt at the tool’s launch.

Creating an Installer

Option 1: Using Inno Setup

packaging Inno setup – My preferred solution is Inno Setup, a popular installer for freeware tools. Download it from here.

packaging Inno setup – Example command line for using Inno Setup:

if exist "C:installLSAunins000.exe" "C:installLSAunins000.exe" /VERYSILENT /NORESTART
"%~dp0ScriptStartLSA.exe" /VERYSILENT /NORESTART

packaging Inno setup – Steps to create an installer with Inno Setup:

  1. Launch Inno Setup and start the wizard.
  2. Enter the script (exe) information.
  3. Specify the path where files will be copied.
  4. Add the files (your exe generated with ps2exe).

Option 2: Using WiX

packaging Inno setup – WiX allows creating an MSI installer with a free tool, suitable for simple installers. Download the required tools:

packaging Inno setup – Orca is a simple MSI file editor. Follow these steps to create an installer with WiX:

  1. Launch WixEdit and create a new project.
  2. Create the directories where files will be copied. For example, a subfolder in “Program Files (x86)”.
  3. Create a component to store your executable. Multiple components can be created in an MSI, typically one per executable or a group of non-exe, non-dll files.
  4. Import your executable into the component.
  5. On the next screen, choose to create a shortcut. Ensure your exe has an icon.
  6. Enter the executable name and shortcut name.
  7. Specify the publisher (Manufacturer), program name, and version. The ID must be unique to your MSI. Generate one here.
  8. The upgradeCode should be the same for every MSI of your application to check for updates based on the version.
  9. Build your project to create the MSI.

packaging Inno setupNote: If you encounter Error: error CNDL0006, ensure a name is added in the component.

packaging Inno setup Overview