I came across a strange error code recently with an application called DYMO label printer. We packaged this application along with the device driver. We have used DPInst.exe to install the Device Driver.
Once the application and the driver installed, we got an error code 256 from software delivery tool. Deployment Team reported this application deployment as a FAILURE. However when we troubleshoot this issue we found a conflicting information. The deployment of the application and the driver is in fact successful. However the EXIT CODE given by the installation script was 256 which was captured in the deployment tool.
During our troubleshooting we came to know that the EXIT CODE was in fact returned by DPInst.exe, which was used to install the device driver. When we manually installed the driver in UI mode, we can see the driver installed successfully.

This clearly indicates that the Driver indeed installed successfully. But why 256 EXIT CODE? We did find the answer to this question. :-)
DPinst.exe returns exit code 256 (DWORD: 0x00000100) if the driver installation is successful as per the below article from Microsoft:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544790(v=vs.85).aspx
So EXIT CODE from DPInst.exe was indeed success. In order to turn this exit code into success, we have modified our Installation script logic to turn 256 EXIT CODE into success.
I'm sure most of you guys are using installation scripts not only to install or uninstall packaged applications but also for so many other activities such as
1. creating installation log files
2. returning exit codes to SWD
3. preinstall and post install checks
4. running Altiris Inventory Agent etc...
So I have created few install and uninstall script that are generic in nature and can me modified according to the requirement. These scripts allows us to capture EXIT CODES.
1. Visual Basic Script Install [Install.vbs]:
'---------------------------------------------------------------------------------------------------
'Script to install an application [MSI & MST] and return the exit code
'---------------------------------------------------------------------------------------------------
Dim oShell, ofso, ScriptDIr, ErrorCode
Set oShell = CreateObject("WScript.Shell")
Set ofso = CreateObject("Scripting.FileSystemObject")
ScriptDIr = oFSO.GetParentFolderName(Wscript.ScriptFullName)
ErrorCode = oShell.Run("MSIEXEC /I " & Chr(34) & ScriptDIr & "\SETUP.MSI" & Chr(34) & " TRANSFORMS=" & Chr(34) & ScriptDIr & "\SETUP.MST" & Chr(34) & " /L*V C:\INSTA_LOGS\SETUP_Install.LOG /QB!-", 0, True)
WScript.Quit(ErrorCode)
Set oShell = Nothing
Set ofso = Nothing
Set oReg = Nothing
2. Visual Basic Script to Uninstall [Uninstall.vbs]:
'---------------------------------------------------------------------------------------------------
'Script to uninstall an application [MSI & MST] and return the exit code
'---------------------------------------------------------------------------------------------------
Dim oShell, ofso, ScriptDIr, ErrorCode
Set oShell = CreateObject("WScript.Shell")
Set ofso = CreateObject("Scripting.FileSystemObject")
ScriptDIr = oFSO.GetParentFolderName(Wscript.ScriptFullName)
ErrorCode = oShell.Run("MSIEXEC /X {PRODUCT_CODE} & " /L*V C:\INSTA_LOGS\SETUP_Uninstall.LOG /QB!-", 0, True)
WScript.Quit(ErrorCode)
Set oShell = Nothing
Set ofso = Nothing
Set oReg = Nothing
3. Batch/Command Script to Install [Install.bat or Install.cmd]:
'---------------------------------------------------------------------------------------------------
'Script to install an application [MSI & MST] and return the exit code
'---------------------------------------------------------------------------------------------------
Set MSIName=SETUP.MSI
Set MSTName=SETUP.MST
Set LogsFolder="C:\INST_LOGS\SETUP_Install.log"
if not exist "C:\INST_LOGS" md "C:\INST_LOGS"
MSIEXEC.EXE /I "%~dp0%MSIName%" TRANSFORMS="%~dp0%MSTName%" /qb-! /l*v %LogsFolder%
set msierror=%errorlevel%
if %msierror%==0 goto :Misc
if %msierror%==1641 goto :Misc
if %msierror%==3010 goto :Misc
goto :ERROR
:Misc
@echo Successfully Installed the Application.
goto :Einde
:ERROR
@echo Error Code is %msierror% if exist %LogFile% type %LogFile%
goto :Einde
:Einde
@echo Job ended at %date% %Time%
Exit %msierror%
4. Batch/Command Script to Uninstall [Uninstall.bat or Uninstall.cmd]:
'---------------------------------------------------------------------------------------------------
'Script to install an application [MSI & MST] and return the exit code
'---------------------------------------------------------------------------------------------------
Set LogsFolder="C:\INST_LOGS\SETUP_Uninstall.log"
if not exist "C:\INST_LOGS" md "C:\INST_LOGS"
MSIEXEC.EXE /X {PRODUCT_CODE} /qb-! /l*v %LogsFolder%
set msierror=%errorlevel%
if %msierror%==0 goto :Misc
if %msierror%==1641 goto :Misc
if %msierror%==3010 goto :Misc
goto :ERROR
:Misc
@echo Successfully Uninstalled the Application.
goto :Einde
:ERROR
@echo Error Code is %msierror% if exist %LogFile% type %LogFile%
goto :Einde
:Einde
@echo Job ended at %date% %Time%
Exit %msierror%
Hope this helps.
Cheers,
Param Chaganti