I have been asked to have an msi package uninstall an exe before
installing itself. The problem is that the uninstall requires a reboot
and this causes a failed install in SMS.

I have been attempting to have the uninstall as a separate package and
set this uninstall as a dependency of the MSI. This does not appear to
work as I am unable to get the uninstall command line working in SMS.

Here is the command line:
cmd /C if exist "C:\Program Files\Zone Labs\Integrity
Client\zauninst.exe" "C:\Program Files\Zone Labs\Integrity
Client\zauninst.exe" /s /noreboot /pwinst "XXXXXXXXXXXXX"

Also, if the uninstall has to be run from a BAT / CMD rather than just
a command line it can not appear in the advertised programs list on
users workstations as it uninstalls the corporate firewall.

I have tried without cmd /c but if exist does not appear to work on its
own (beginning with 'if exist').

Does anybody have any suggestions?
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Have you tried killing the exe process before deleting it?

Assuming there is no risk of data loss for the user (don't try it with winword.exe)!!
Answered 05/21/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Maybe I'm missing something here. Are you just looking to delete an .exe file if it exists before an msi installs?

Why not just toss in a vbscripted custom action to delete the file in the beginning of the sequence in the MSI?
Answered 05/23/2005 by: Bladerun
Green Belt

Please log in to comment
The task can not be killed as the exe is a service controlled by a virtual device driver (Corporate Firewall).

This is a complete package that needs to be uninstalled along with all its registry entries.

The reason I am not using my package to uninstall is because the uninstall requires a reboot. If a package reboots itself then this is detected by SMS as a failed install (SMS must reboot as the end of the install / uninstall). Thus the uninstall needs to be its own package so this can be run and rebooted, then the install run and rebooted (That is why I need to send the command line via SMS).
Answered 05/24/2005 by: Flintstone
Senior Yellow Belt

Please log in to comment
How about something like this:

On Error Resume Next

Const sMYEXE = "%ProgramFiles%\Zone Labs\Integrity Client\zauninst.exe"

Const sMSIEXEC = "%SystemRoot%\System32\Msiexec.exe /qb /i "

Const sMYMSI = "WhatEver.msi"

Set oWsh = CreateObject("Wscript.Shell")

sCurrDir = Replace(Wscript.ScriptFullName, Wscript.ScriptName, "")

oWsh.Run sMYEXE & " /s /noreboot /pwinst " & Chr(34) & "XXXXXXXXXXXXX" & Chr(34), 5, True

iReturn = oWsh.Run(sMSIEXEC & Chr(34) & sCurrDir & sMYMSI & Chr(34), 5, True)


I obviously haven't tested this, so there may be some bugs. But this method should work.

Remember to specify "wscript.exe" as the executable for the "vbs" script (in SMS) if you decide to try it.
Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Thanks for that but this still does not work ... this is what I have done so far:

I created the following script:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

On Error Resume Next

WSHShell.Run""".\zauninst.exe"" /s /noreboot /pwinst ""XXXXXXXXXX""", 1, true


Returning 0 at the end sends 0 (Success) to SMS.

I then put zauninst.exe and zauninst.vbs on the distribution point and use wscript.exe zauninst.vbs as the command line.

The reason I am not using a drive letter is because then you would need to specify in SMS that the program requires a drive letter instead of a UNC path ... if you set the requirement of a drive letter it is not possible to have the application download.

The script runs fine from the command line if I copy the programs to any directory on the local machine and run it.

Does anybody else have any suggestions?
Answered 05/26/2005 by: Flintstone
Senior Yellow Belt

Please log in to comment
Sorry I forgot you for a while...Here's some ammendments to your script (since mine wasn't good enough):[;)]

On Error Resume Next

Set WshShell = CreateObject("WScript.Shell")

sCurrentDir = Replace(Wscript.ScriptFullName, Wscript.ScriptName, "")

iRet = WSHShell.Run(Chr(34) & sCurrentDir & "zauninst.exe" & Chr(34) &_
" /s /noreboot /pwinst " & Chr(34) & "XXXXXXXXXX" & Chr(34), 1, true)


Why would you hard-code a return code of 0? How would you know if it worked?
Answered 05/31/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment