cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RayKode
Level 6

How to prevent a re-installation of a patch

Hello folks.

I create a patch with via Patch Design. (IS 2012 Professional)
The patch in NOT un-installable.

I apply it to a pc and the patch works perfectly.

I try applying the patch to a version of my product for which the patch was “not” designed, and I get a Windows Installer dialog saying just that.
A GOOD thing.

So, for grins, I tried applying my patch more than once, on a pc for which it “was” designed.

And the patch installs.
That really confuses me.
I had THOUGHT, at a minimum, I would receive a Windows installer dialog indicating the currently installed patch, could not be uninstalled.
I had hoped, for some kind of dialog indicating the patch is already installed.
But, neither happened.

Is there a way for me to prevent the patch from being installed, if it is already installed on the pc ?

Thanks in advance
.
Labels (1)
0 Kudos

(1) Reply
surya4u
Level 4

How do you check whether the Patch/HotFix is installed already?

1. Add a VBScript Custom Action (stored in binary table)– CheckIfPatchInstalled

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Function: CheckIfPatchInstalled
''' Purpose: Checks to see if a patch is installed and sets the value of the property
''' 'PATCHINSTALLED' to "true". This property value is used by the Custom action
''' 'CheckIfPatchInstalledError' to display an error.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function IsPatchInstalled()
Dim sProductCode, sProductVersionHF, sProductVersionCurrent
On Error Resume Next
sProductCode = Session.Property("ProductCode")
sProductVersionCurrent = Session.Installer.ProductInfo(sProductCode, "VersionString")
sProductVersionBase = Session.Property("ProductVersion")
If (sProductVersionCurrent = sProductVersionBase) Then
Session.Property("PATCHINSTALLED") = "true"
End If
End Function

2. Schedule the CheckIfPatchInstalled as Immediate CA after ISSetupFilesExtract in both Install UI Sequence and Install Exec Sequence with the condition PATCH.
3. Add an Error Custom Action as Immediate CA after CheckIfPatchInstalled in both Install UI Sequence and Install Exec Sequence with the condition PATCH AND PATCHINSTALLED.
4. Add a property PATCHINSTALLED in property manager and leave it empty.

5. Add an Error Custom Action (CheckIfPatchInstalledError) as Immediate CA after CheckIfPatchInstalled in both Install UI Sequence and Install Exec Sequence with the condition PATCH AND PATCHINSTALLED.

6. Add a new Custom Action - CheckIfPatchInstalledError
7. Add the appropriate error message say “25000 - An existing upgrade is already installed. Please remove it before installing this upgrade” to the Error Table in the direct editor and use the Error Number in the CA

8. Create the Patch and apply the patch where the main installer is installed. Running the patch again on the same machine should display the message "An existing upgrade is already installed. Please remove it before installing this upgrade." abort the installation.

I hope this will help you.
0 Kudos