Intune Deployment Guide
Intune install and uninstall commands
Overview
Install and uninstall commands define how Intune installs and removes a Win32 app on a Windows device. These values live in the Program step when you add a Windows app (Win32).
A good command is silent, predictable, and tested in the same context that Intune uses during deployment.
What install and uninstall commands do
When a Win32 app is assigned, the Intune Management Extension downloads the app content, checks requirements, evaluates detection, and runs the install command only when the app is not already detected.
- The install command adds or updates the app on the device
- The uninstall command removes the app when uninstall intent is assigned
- Both commands should run silently without waiting for user input
Detection still decides whether Intune treats the app as installed. See Intune detection rules explained for the install/detect relationship.
Program tab in Intune
The Program step contains the command line settings, execution context, restart behavior, and return codes. Keep the values simple and testable before assigning the app broadly.
Specify app installation and uninstallation settings, including command line, time limits, restart behavior, and return codes.
Specify return codes to indicate post-installation behavior:
Install command
The install command must run the installer in silent mode. For MSI installers, use msiexec with quiet parameters. For EXE installers, use the vendor-supported silent switch.
- MSI example:
msiexec /i "app.msi" /qn - EXE example:
setup.exe /quiet /norestart - Script example:
powershell.exe -ExecutionPolicy Bypass -File install.ps1
Uninstall command
The uninstall command should remove the app silently. Validate it separately from the install command because apps often use a different executable, product code, or switch for uninstall.
- MSI example:
msiexec /x "{PRODUCT-CODE}" /qn - EXE example:
"%ProgramFiles%\App\uninstall.exe" /quiet - Script example:
powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1
Using CMD scripts
Use a CMD script when the install or uninstall process needs a short sequence of commands, copied files, or simple cleanup steps. Keep the script in the package root so the Program tab can call it directly.
- Use
cmd.exe /cso the script runs and exits - Place
install.cmdanduninstall.cmdin the same folder that you package with IntuneWinAppUtil - Avoid prompts,
pause, or commands that wait for user input
Using PowerShell scripts
Use PowerShell when the install or uninstall process needs logic, validation, registry cleanup, service handling, or controlled error handling. In Intune, PowerShell scripts can be selected directly from the Program tab instead of being called only as a command line.
The flow is different from a direct command:
- Select PowerShell script as the installer and uninstaller type
- Select a custom install script and uninstall script
- Configure script options such as signature check and 32-bit execution
- Let Intune run the script and evaluate the exit code
Use the script panel when you want Intune to store and run the script file directly. This is cleaner than embedding long PowerShell one-liners in the command field.
- Keep install and uninstall scripts in the package source folder
- Make scripts silent and avoid prompts, message boxes, or interactive UI
- Use relative paths for supporting files included in the .intunewin package
- Return
exit 0for success and a non-zero exit code for failure - Use Run script as 32-bit process only when the app requires 32-bit registry or file system behavior
Install behavior: System vs User
Install behavior controls the account context used by Intune. Most device-wide Win32 apps should use System. Use User only when the installer requires the signed-in user profile.
If a command works manually but fails in Intune, context is one of the first things to check. See System vs User context in Intune for more detail.
Command examples
Use the examples below as starting points. Always confirm the vendor-supported silent switches for the specific app version you are packaging.
| Installer type | Install command | Uninstall command |
|---|---|---|
| Silent EXE | setup.exe /quiet /norestart | setup.exe /uninstall /quiet |
| 7-Zip EXE | 7z.exe /S | "%ProgramFiles%-Zip\Uninstall.exe" /S |
| MSI | msiexec /i app.msi /qn | msiexec /x {PRODUCT-CODE} /qn |
| Wrapped script | powershell.exe -ExecutionPolicy Bypass -File install.ps1 | powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1 |
Restart behavior and return codes
Restart behavior controls what Intune does when an installer requires or recommends a reboot. Keep the default return codes unless your installer uses custom exit codes that need special handling.
- Use No specific action when the installer can complete without forcing a reboot
- Review return codes when Intune reports failed installs even though the app appears installed
- Test restart behavior during pilot deployment before assigning broadly
For deeper behavior planning, see return codes and install behavior in Intune.
Common command mistakes
Most command problems come from using a non-silent installer, relying on the wrong working directory, or testing under a different context than Intune uses.
Quick checklist
- Confirm the command runs silently
- Test install and uninstall separately
- Use quotes around paths that contain spaces
- Validate commands under System context when install behavior is System
- Make sure the command exits instead of waiting for user input
Troubleshooting command issues
If installation fails, start with the command before changing assignments or detection rules.
| Issue | What to check |
|---|---|
| Install command works manually but fails in Intune | Check System vs User context and whether the command requires an interactive desktop. |
| Setup window appears | Verify the silent switch for the exact installer version. |
| Uninstall does not run | Confirm the uninstall executable path or MSI product code. |
| Install times out | Check whether the command waits for a child process or prompt. |
| Install succeeds but status fails | Check detection rules and return codes after the command completes. |
| Need detailed logs | Review C:\ProgramData\Microsoft\IntuneManagementExtension\Logs. |
Best practices
- Use vendor-supported silent switches instead of guessed parameters
- Prefer simple commands over complex one-liners
- Keep supporting files inside the .intunewin package folder
- Document the tested install and uninstall commands
- Validate detection after install and after uninstall

Leave a feedback
Include versions, steps, and any error text if you have them.