intunemdms.com

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.

Add App Program
Windows app (Win32)
✓ App information 2 Program 3 Requirements 4 Detection rules

Specify app installation and uninstallation settings, including command line, time limits, restart behavior, and return codes.

Command line
msiexec /i “7z2601-x64.msi” /qn
Command line
msiexec /x “{23170F69-40C1-2702-2601-000001000000}” /qn
60
YesNo
SystemUser
App install may force a device restart

Specify return codes to indicate post-installation behavior:

Return codeCode type
0Success
1707Success
3010Soft reboot
1641Hard reboot
1618Retry
+ Add

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.

ProgramCMD script commands
Windows app (Win32)
cmd.exe /c install.cmd
cmd.exe /c uninstall.cmd
SystemUser
  • Use cmd.exe /c so the script runs and exits
  • Place install.cmd and uninstall.cmd in 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
ProgramPowerShell script selected
Windows app (Win32)
PowerShell script
PowerShell script
60
SystemUser
App install may force a device restart
Install script×
Install 7-Zip
install.ps1Select a file
Start-Process .z2601-x64.exe -ArgumentList '/S' -Wait
exit 
YesNo
YesNo

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 0 for 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 typeInstall commandUninstall command
Silent EXEsetup.exe /quiet /norestartsetup.exe /uninstall /quiet
7-Zip EXE7z.exe /S"%ProgramFiles%-Zip\Uninstall.exe" /S
MSImsiexec /i app.msi /qnmsiexec /x {PRODUCT-CODE} /qn
Wrapped scriptpowershell.exe -ExecutionPolicy Bypass -File install.ps1powershell.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.

IssueWhat to check
Install command works manually but fails in IntuneCheck System vs User context and whether the command requires an interactive desktop.
Setup window appearsVerify the silent switch for the exact installer version.
Uninstall does not runConfirm the uninstall executable path or MSI product code.
Install times outCheck whether the command waits for a child process or prompt.
Install succeeds but status failsCheck detection rules and return codes after the command completes.
Need detailed logsReview 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.