Msiexec silent install builder
Build an msiexec command for an unattended install, uninstall, repair or patch, as a plain command line and as a PowerShell block that returns a sensible exit code. Further down: paste a command to have it explained, what each MSI exit code means, and the options and properties.
Command Prompt or RMM command step
msiexec /i <package.msi> /qn /norestart
PowerShell: waits for the installer, treats 0, 1641 and 3010 as success
Explain an msiexec command
Paste an msiexec command to see what each part does and what to check before it runs.
| Part | What it does |
|---|
MSI exit codes
Msiexec returns a Windows error code. Three values mean success: 0, and 1641 and 3010 when a restart is involved. Everything else is a failure, and the verbose log is the place to find the reason.
| Code | Name | Meaning and what to check |
|---|---|---|
| 0 | ERROR_SUCCESS | Completed successfully. |
| 13 | ERROR_INVALID_DATA | The data is invalid. |
| 87 | ERROR_INVALID_PARAMETER | A parameter was invalid. |
| 120 | ERROR_CALL_NOT_IMPLEMENTED | A custom action called a function that custom actions are not allowed to call. |
| 1259 | ERROR_APPHELP_BLOCK | Windows flagged the product as possibly incompatible with this version, and the user chose not to install it. |
| 1601 | ERROR_INSTALL_SERVICE_FAILURE | The Windows Installer service could not be reached. Check that the service is not disabled. |
| 1602 | ERROR_INSTALL_USEREXIT | The user cancelled the installation. |
| 1603 | ERROR_INSTALL_FAILURE | Fatal error during installation. The catch-all failure: open the verbose log and search for "return value 3" to find the action that failed. |
| 1604 | ERROR_INSTALL_SUSPEND | Installation suspended before it finished. |
| 1605 | ERROR_UNKNOWN_PRODUCT | The product is not installed, at least not for this context. Check the product code, and whether it was installed per user while you are running as SYSTEM. |
| 1606 | ERROR_UNKNOWN_FEATURE | The feature name is not recognized. |
| 1607 | ERROR_UNKNOWN_COMPONENT | The component name is not recognized. |
| 1608 | ERROR_UNKNOWN_PROPERTY | The property name is not recognized. |
| 1609 | ERROR_INVALID_HANDLE_STATE | The handle is in an invalid state. |
| 1610 | ERROR_BAD_CONFIGURATION | The configuration data for the product is corrupt. |
| 1611 | ERROR_INDEX_ABSENT | The component qualifier is not present. |
| 1612 | ERROR_INSTALL_SOURCE_ABSENT | The installation source is not available. The original MSI that a repair, patch or uninstall needs is gone from where it was installed from. |
| 1613 | ERROR_INSTALL_PACKAGE_VERSION | The package needs a newer version of Windows Installer than this machine has. |
| 1614 | ERROR_PRODUCT_UNINSTALLED | The product is uninstalled. |
| 1615 | ERROR_BAD_QUERY_SYNTAX | A SQL query in the package is invalid or unsupported. |
| 1616 | ERROR_INVALID_FIELD | A record field does not exist. |
| 1618 | ERROR_INSTALL_ALREADY_RUNNING | Another installation is in progress. Only one MSI install runs at a time: wait and retry. |
| 1619 | ERROR_INSTALL_PACKAGE_OPEN_FAILED | The package could not be opened. Check the path and the quoting, and that the account running the command can read the file: SYSTEM cannot see a user's mapped drives. |
| 1620 | ERROR_INSTALL_PACKAGE_INVALID | The file opened but is not a valid Windows Installer package. Often a truncated download. |
| 1621 | ERROR_INSTALL_UI_FAILURE | The installer's user interface failed to start. |
| 1622 | ERROR_INSTALL_LOG_FAILURE | The log file could not be opened. Check that the log folder exists and is writable. |
| 1623 | ERROR_INSTALL_LANGUAGE_UNSUPPORTED | The package's language is not supported on this system. |
| 1624 | ERROR_INSTALL_TRANSFORM_FAILURE | A transform could not be applied. Check the paths in TRANSFORMS and that the .mst files match this package. |
| 1625 | ERROR_INSTALL_PACKAGE_REJECTED | System policy forbids this installation, for example software restriction or AppLocker rules. |
| 1626 | ERROR_FUNCTION_NOT_CALLED | A function could not be executed. |
| 1627 | ERROR_FUNCTION_FAILED | A function failed while it was running. |
| 1628 | ERROR_INVALID_TABLE | An invalid or unknown table was named. |
| 1629 | ERROR_DATATYPE_MISMATCH | The data supplied is of the wrong type. |
| 1630 | ERROR_UNSUPPORTED_TYPE | Data of this type is not supported. |
| 1631 | ERROR_CREATE_FAILED | The Windows Installer service failed to start. |
| 1632 | ERROR_INSTALL_TEMP_UNWRITABLE | The Temp folder is full or cannot be written to. |
| 1633 | ERROR_INSTALL_PLATFORM_UNSUPPORTED | The package is not supported on this platform. The usual cause is an x64 or ARM64 package on a different architecture. |
| 1634 | ERROR_INSTALL_NOTUSED | The component is not used on this machine. |
| 1635 | ERROR_PATCH_PACKAGE_OPEN_FAILED | The patch file could not be opened. Check the path and access, as for 1619. |
| 1636 | ERROR_PATCH_PACKAGE_INVALID | The patch file is not a valid Windows Installer patch. |
| 1637 | ERROR_PATCH_PACKAGE_UNSUPPORTED | The patch needs a newer version of Windows Installer than this machine has. |
| 1638 | ERROR_PRODUCT_VERSION | Another version of this product is already installed. Uninstall it first, or use the vendor's upgrade package. |
| 1639 | ERROR_INVALID_COMMAND_LINE | Invalid command line. Check the quoting, the switch spelling and the property names. |
| 1640 | ERROR_INSTALL_REMOTE_DISALLOWED | Installing from a Remote Desktop Services client session is not permitted for this user. |
| 1641 | ERROR_SUCCESS_REBOOT_INITIATED | Success. The installer has started a restart. |
| 1642 | ERROR_PATCH_TARGET_NOT_FOUND | The patch does not apply: the product it updates is missing or is a different version. |
| 1643 | ERROR_PATCH_PACKAGE_REJECTED | System policy does not allow the patch. |
| 1644 | ERROR_INSTALL_TRANSFORM_REJECTED | System policy does not allow one or more of the transforms. |
| 1645 | ERROR_INSTALL_REMOTE_PROHIBITED | Windows Installer does not permit installation from a Remote Desktop connection. |
| 1646 | ERROR_PATCH_REMOVAL_UNSUPPORTED | The patch cannot be uninstalled. |
| 1647 | ERROR_UNKNOWN_PATCH | The patch is not applied to this product. |
| 1648 | ERROR_PATCH_NO_SEQUENCE | No valid order could be found for the set of patches. |
| 1649 | ERROR_PATCH_REMOVAL_DISALLOWED | Policy does not allow patches to be removed. |
| 1650 | ERROR_INVALID_PATCH_XML | The XML data for the patch is invalid. |
| 1651 | ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT | An administrator could not apply the patch to a product that is only advertised per user or per machine. |
| 1652 | ERROR_INSTALL_SERVICE_SAFEBOOT | The Windows Installer service is not available in safe mode. |
| 1653 | ERROR_ROLLBACK_DISABLED | Rollback is disabled, so a transaction across several packages cannot run. |
| 1654 | ERROR_INSTALL_REJECTED | Windows refused the package. Some ARM editions of Windows only accept installer packages signed by Microsoft. |
| 3010 | ERROR_SUCCESS_REBOOT_REQUIRED | Success. A restart is needed to finish, and has not been started. |
A code that is not in the table is a general Windows error passed through by the installer. On Windows, net helpmsg followed by the number shows its text.
Msiexec options
The options of msiexec, by what they are for. The explainer above reads this table and the one after it.
| Option | What it does |
|---|---|
| Action | |
/i, /package | Install or configure a product. Takes the MSI file or a product code. |
/x, /uninstall | Uninstall. Takes the MSI file or the product code in braces. Given a patch file together with /package, /uninstall removes that patch. |
/f | Repair. The letters after it choose what: p files that are missing, o missing or older, e missing, equal or older, d missing or of a different version, c missing or with a wrong checksum, a all files, u user registry entries, m computer registry entries, s shortcuts, v run from the source and cache the package again. Without letters it is omus. Properties on the command line are ignored. |
/a | Administrative installation: put the product on a network location to install from. |
/ju, /jm | Advertise the product: u to the current user, m to all users of the computer. Properties on the command line are ignored. |
/t | With /j: the transforms to apply. |
/g | With /j: the language identifier. |
/update | Apply one or more patch files (.msp), separated by semicolons. |
/p | Apply one or more patch files (.msp), separated by semicolons. The older form of /update. |
/c | With /j and /t: advertise a new instance of the product. |
/n | The product code of one instance, where a product is installed more than once. |
/y | Register a DLL by calling its own registration function. |
/z | Unregister a DLL by calling its own function for that. |
/m | Write an SMS status file (.mif) of that name, eight characters at most. |
| What the user sees | |
/qn, /q, /quiet | No user interface. |
/qb | Basic user interface. |
/qr | Reduced user interface. |
/qf | Full user interface. |
+, -, ! | Signs after a level. /qn+ and /qb+: a dialog box at the end. /qb-: no dialog boxes at all. /qb!: no Cancel button. |
/passive | Unattended: a progress bar only, no questions, and the user cannot cancel. |
| Restart | |
/norestart | Do not restart when the installation finishes. |
/promptrestart | Ask the user before a required restart. |
/forcerestart | Always restart when the installation finishes. |
| Log | |
/l letters file | Write a log. The letters choose what goes in: i status messages, w warnings, e error messages, a the start of actions, r action records, u user requests, c the first interface settings, m out of memory or fatal exit, o out of disk space, p properties at the end, v verbose output, x extra debugging output, * all of these but v and x, + append to the file, ! write each line at once. Without letters it is iwearmo. The folder of the log file must exist: the installer does not create it. |
/log file | Write a log. The same as /l*. |
| Other | |
/?, /h, /help | Show how msiexec is used. |
NAME=value | Set a public property. Names are upper case. A value with spaces goes in quotation marks, and a quotation mark inside a value is doubled. |
Properties often set on the command line
A package also has properties of its own, such as its install folder. Those are in the vendor's documentation, not here.
| Property | What it does |
|---|---|
ALLUSERS | 1 installs for all users of the computer. 2 lets the installer choose from the user's rights and from MSIINSTALLPERUSER. Not set, the installation is for the current user. |
MSIINSTALLPERUSER | Read only with ALLUSERS=2, for a package written for both kinds of installation: 1 asks for the current user only, an empty value for all users. |
REBOOT | Force: restart at the end; with an interface the user is asked first. Suppress: no restart at the end, but one the package calls for midway still happens. ReallySuppress: no restart and no question at all. The installer reads only the first letter. |
TRANSFORMS | The transform files (.mst) to apply, in this order, separated by semicolons. A name that starts with a colon is a transform stored inside the MSI file. |
TARGETDIR | The root destination folder. In an administrative installation (/a), the place the package is copied to. |
ADDLOCAL | The features to install on the computer, separated by commas. ALL is every feature. Feature names are case-sensitive. |
REMOVE | The features to remove, separated by commas. ALL is every feature. |
REINSTALL | The features to reinstall, separated by commas, or ALL. Only features that are installed already are reinstalled. Set REINSTALLMODE with it. |
REINSTALLMODE | What a reinstall replaces, in the letters of /f. |
PATCH | Patch files (.msp) to apply during an install, separated by semicolons. Ignored when /p is used. |
MSIPATCHREMOVE | The patches to remove, each as a file or a patch code, separated by semicolons. |
ARPSYSTEMCOMPONENT | 1 keeps the product out of the list of installed programs in Control Panel. |
More Windows tools
-
Windows error code lookup
Look up 0x80070005, 0xC000006D, 1603 or any other system error, HRESULT, NTSTATUS or bug check code.
-
Robocopy command builder
Build a robocopy command line, paste one to see what each switch does, and decode its exit codes.
-
PowerShell EncodedCommand decoder
Read the script inside an encoded PowerShell command, layer by layer, or encode one.
-
.reg file value decoder
hex(2), hex(7), hex(b) and dword values of a .reg file as text and numbers, and a value written as .reg lines.
-
Certificate decoder
Read a certificate, a chain or a request: names, dates, thumbprint, template and account SID.
-
Access mask decoder
Read an access mask such as 0x1200A9 or -1610612736 as file, registry or Active Directory rights.
-
icacls explainer and command builder
Read icacls output such as (OI)(CI)(RX) in plain words, or build commands to grant, deny and remove rights.
-
KMS client keys and slmgr commands
Get the KMS client setup key (GVLK) of a Windows or Windows Server edition and the slmgr commands to activate it.
-
File hash checker
Work out the SHA-256, SHA-1, SHA-512 or MD5 hash of a file in your browser and compare it with the publisher's.
-
File type from its first bytes
What a file is by its first bytes, not its name: PDF, ZIP, Office, EXE or DLL with its CPU and bitness.
-
Zone.Identifier reader
The Mark of the Web on a downloaded file: its zone and address, and the commands that show and remove it.
-
Windows and IANA time zone names
Eastern Standard Time to America/New_York or America/Toronto and back, with tzutil, PowerShell and timedatectl.