Defining returncodes
Defining returncodes
By default, Packaging PowerBench packages are terminated with a number of standard return values. The following table lists these and describes their meaning:
Returncode |
Description |
0 |
Package executed successfully. |
1618 |
Another MSI installation was carried out at the same time. The installation cannot be executed at this time. Package execution must be repeated. |
1641 |
Installation of the MSI package was successful, but a restart is required. |
1707 |
Package successfully executed. |
3010 |
Installation of the MSI package was successful, but a restart is required. |
60001 |
An error occurred during package execution, execution was not successful. |
60012 |
The execution of the script was deferred using the script command Show-ADTInstallationWelcome. |
69000 |
The script was exited as an unexecuted package via the Exit-Package command. |
69002 |
The script was terminated as a failed package via the Exit-Package command. |
Starting with version 4.0 of the Packaging PowerBench, it is also possible to define individual return codes for individual packages. This can be useful, for example, if certain installation routines provide unusual return values or if certain states or installation results are to be documented with these individual codes.
To define user-defined returncodes, you must edit the Package.xml of the respective package - similar to the definition of installation-parameters.
Package.xml has a <Properties> node, under which a number of standard properties are defined. To declare an individual exit code, create a new property node and set the "Name" property to "ExitCodes". In the value of the property, enter a list of the exit codes you require and then specify whether the return value should be treated as success ("success"), failure ("failure"), success with required restart ("softReboot"), success with immediate restart ("hardReboot") or retry ("retry").
For example, to define return code 11 as a success with a required restart, you would make the following entry in Package.xml:
<Properties>
...
<Property Name="ExitCodes">11=softreboot</Property>
</Properties>
Microsoft Configuration Manager also allows you to enter user-defined display names for individual return codes, which you can enter as follows in the example above:
<Properties>
...
<Property Name="ExitCodes">11=softreboot,MyCustomSuccessWithReboot</Property>
</Properties>
In fact, it is also possible to define the return codes for Microsoft Intune and Microsoft Configuration Manager independently of each other. In this case, you do not define the property using the generally valid name "ExitCodes", but using the product-specific names "Intune.ExitCodes" or "ConfigMgr.ExitCodes". The following excerpt illustrates the procedure:
<Properties>
...
<Property Name="Intune.ExitCodes">11=softreboot</Property>
<Property Name="ConfigMgr.ExitCodes">11=softreboot,MyCustomSuccessWithReboot</Property>
</Properties>