What It Does
The script runs on the computer that holds the installer files. It checks that SourceFolder and SetupFile exist and that both IntuneWinAppUtil.exe and OutputFolder are outside SourceFolder. By default it refuses to run the tool without a valid Microsoft signature. AllowUnsignedTool overrides the signature requirement.
The .intunewin file goes to OutputFolder, by default ProgramData\MSPOutpost\IntuneWin, and an older package of the same name is overwritten. The answer names the package and its size. If the tool ends with an error or writes no package, the run fails and shows what the tool printed.
It compares the newest .intunewin in OutputFolder with the newest installer file. If the package is newer, it reports Already packaged without checking the package name or contents against SetupFile. Use a separate output folder per app or set Rebuild=true. A dry run checks the inputs without building.
It does not download the tool or talk to Intune. Uploading the package, and setting its detection rules, requirements and return codes, is the next step in the Intune admin center.
Before You Run It
- Download Microsoft's Win32 Content Prep Tool from its GitHub repository and keep IntuneWinAppUtil.exe outside the installer folder.
- Put every file the installer needs in one folder, with the setup file in it.
- AllowUnsignedTool exists for a copy you have checked yourself; leave it off otherwise.
Type and Risk
- Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
- Risk: Low. Set DryRun=true, or run it with -WhatIf, to list every change without making any.
- What it changes: Writes one .intunewin file under OutputFolder; nothing is uploaded to Intune.
- Restart: It never restarts the machine.
- Typical run: Under 5 minutes (longer for large installers).
- Example answer: "Packaged 7z2501-x64.msi into 7z2501-x64.intunewin (2 MB) in C:\ProgramData\MSPOutpost\IntuneWin; upload it to Intune next"
- Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.
Inputs
Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.
- SourceFolder: Folder holding all the installer files. Required.
- SetupFile: The setup file (for example setup.exe or app.msi), as a path inside SourceFolder or just its name. Required.
- IntuneWinAppUtilPath: Full path of IntuneWinAppUtil.exe on this computer, outside SourceFolder. Required (the script downloads nothing).
- OutputFolder: Where the .intunewin file is written. Default: the IntuneWin folder under the MSP Outpost data folder (ProgramData\MSPOutpost\IntuneWin).
- Rebuild: true packages again even if an up-to-date .intunewin is already in OutputFolder. Default false.
- AllowUnsignedTool: true runs a tool whose signature is not a valid Microsoft one. Default false.
- TimeoutMinutes: Stop the tool and fail after this many minutes. Whole number, 1 to 240. Default 30.
Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.