In LANDesk Management Suite 9.0 was introduced the ability to map return codes form the installers executed through Software Distribution.
That feature is very handy because not all of the software houses are using the return code 0 when the installation is successful but some of them uses to return a special (custom) code to indicate that, as example, "the installation was successful but .... some other actions are requested".
In the past the only way to handle these codes was to wrap the installer executable (or MSI) in a batch that was then handling the return code.
With the version 9.0 of LANDesk Management Suite is possible to map these specific codes to a specific meaning (fail / success) and customized message.
If you are going to implement this functionality you will find handy this very simple tool that returns the exit code found in a specific registry key.
HOW THE UTILITY WORKS
The utility requires .NET Framework 2.0 and its usage is very simple and self-explanatory (just launch it on the command line).
- Create on the client where you are going to distribute it a DWORD value retcode under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\LANDesk
- assign to this DWORD value the value of the exit code you want back. Remember to select the appropriate BASE option (decimal or hexadecimal) when you enter there values. The default is hexadecimal and so if enter the value 80, the return code will be converted in decimal (128).
- If you want that the program waits a certain amounts of milleseconds before to terminate create a DWORD value called delay under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\LANDesk and assign to it the delay expressed in milliseconds.
- Create a package to distribute the RetCode.exe executable that you find attached to this document.
- Create the appropriate Return Code mappings that you need to test and associate it with the package.
- Schedule the job and see the result returned.
Q. Why this utility read the value from the registry and not from the command line? Was not this more simple that play around with the registry?
A. Indeed it was more simple to accept a parameter as return code but think to this scenario: you want to test the return code mapping functionality scheduling the job to 4 different devices and you want a different return code for each of them. If you need to pass the return code as parameter how can you achieve this?
Q. What is the level of support about this tool?
A. The tool is provided AS IS without express warranties. Use it at your own risk.
Q. But what about if I have questions or I need help?
A. Please feel free to add comment to this article to obtain help or suggest improvements to this tool.
Q. How can I return a negative return code?
A. Create on the client where you are going to distribute it a DWORD value negativeretcode under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\LANDesk. The value will be converted in a negative value and passed as return code.
Q. What happens if I define both the value negativeretcode and retcode ?
A. Very naughy question: in this case only negativeretcode is considered.