Since Intune (and probably other software distribution mechanisms) only support MSI or EXE execution, the Install.cmd script that was developed for each package becomes, at first glance, useless. We were able to work around this using the Inno Setup package, which is available for free. To facilitate this, we've authored a PowerShell script that will create an ISS script file and then compile it using the Inno Setup utilities, producing a single EXE.
To execute the EXE, just run it. To run silently, add the /VERYSILENT switch at the end and it will handle everything and return a reboot code (3010) if one is needed, letting Intune marshall the actual reboot.
The PowerShell script uses a set of parameters to work:
- PackagePath - The path to the folder containing the package flat files. This is required. The folder name holding the files will become the EXE file name.
- InstallCmd - The file to execute to perform the installation. Defaults to Install.cmd.
- AppName - The name of the application. Populates the file header in the EXE generated. This is optional.
- Publisher - The publisher of the application. Populates the file header in the EXE generated. This is optional.
- Version - The version of the application. Populates the file header in the EXE generated. This is optional.
The script checks to be sure that the supplied PackagePath and InstallCmd exist.
The script then creates the first part of the ISS script file using some standardized settings.
The script then adds the subfolders found in the package folder to the list of folders.
Next, it adds the list of files to the ISS file so that they can be included in the archive within the EXE. It makes an exception for the $InstallCmd file since we need to handle that one in a slightly different way.
Finally, the script runs the Inno Setup compliler to create the EXE.