So I have an MSI file that I'd like to install only if a particular file/folder does not exist on the workstation. I have created a batch file that says the following:
if not exist "C:\Program Files\Program X" set errorlevel=1
EXIT /B %ERRORLEVEL%
I have verified that this script is working and exiting with the correct error level based on the existence of the program directory.
In DC, I set my install configuration to run the batch file and checked the checkbox for 'Continue the installation if the exit code is 1'. So in theory, the program will only install if the directory is not there. Sure enough, I can see that it's trying to install the program, even when the directory is indeed there. dcsoftwaredeployment.log seems to show that the batch file is working as expected, it just seems to be ignoring the correct errorlevel. The log shows:
ExecutePrePostCmd : Error while performing ExecutePrePostCmd function
Success Error Code : 1
Return Error Code : 0
It then procees to install the msi (which it shouldn't if the errorlevel is not 1.
Thoughts? The logs show the exact same thing on laptops that don't have the folder as well, so it seems like the configuration is ignoring the 'continue installation if the exit code is...' portion.