Can't Remove Patch from Add/Remove Programs
Updated: 22 May 2010 | 13 comments
Hi all,
I have a question regarding Patch creation and making patches removable. We create the patch with all the Allow Removal options checked and populated (meta data). When the patch is applied to our main install they do appear in Add/Remove programs as updates, but there is no remove button.
If I create small junk installs in both WfWI 6.2 and Installation Studio 7, they seem to be removable as expected. I ran the test in both versions to rule out any bug in Installation Studio as that is what is being used for our current installs.
Any ideas on what we may be missing, please let me know.
Thanks!
discussion Filed Under:
Comments
When the patch is applied to our main install they do appear in Add/Remove programs as updates, but there is no remove button.
Do you mean apply it after the main msi has been installed or applied to an administrative install?
Oh, after the .msi has been installed. For our main product patches, there is no remove button when viewed in ARP. If I create small test installs, run the .msi, create a patch to that and apply, I see the remove button.
Does it have anything to do with ARP settings in the main install? I don't currently have the templates with me as I'm not at work, but I know that I don't have the remove button disabled as I can remove that via ARP.
Removeable patches only came in with Windows Installer 3.0, so before we go any further, can you check that your test machine is not running an earlier version of windows installer? Secondly, the option to remove patches from ARP only started with XP SP2, so you need to confirm that your test machine is running XP SP2 at least.
Finally, open MSI.CHM, and look up "Uninstalling Patches" - there is a wealth of information in there.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Windows Installer = 3.01.4000.1823
I'm running on XP SP2
So, I guess I have to hit the .chm!
Could you post the content of the PCP file?
If you open the MSI in ORCA, then apply the MSP and then check the MsiPatchMetadata table; could you verify that the AllowRemoval property is set to 1.
Sorry, I haven't checked the post in a while, but here's the pcp file. The value is 1 in there.
I tried applying the patch in Orca, but there was no MsiPatchMetadata table. I added this in Orca then tried to apply the patch again, but this table is not getting populated. There were a bunch of other MsiPatch.. tables that were available to add via Orca. I wonder if I should get them in there too. I did test this, but that woo made no difference.
I then noticed that we had at one time used MsiPatchCertificate entries, but this patch is not signed so I thought that might be the problem. I cleared those records, but that still didn't make a difference.
I then thought that it may not be working since the deployed package did not have the MsiPatchMetaData. So I took the backup of that .msi and added the table (not the other MsiPatch.. tables) so now the current and package to update have the table. I created the patch and viewed in Orca through the current .msi and that table still does not populate.
I don't know what I'm missing other than making sure all the msipatch tables are in there.
Could you run the below script against the MSP and attach the result.
' Usage: [CScript | WScript] MsiExtractPatchXMLData.vbs <full path to .MSP>
' Example:
' cscript MsiExtractPatchXMLData.vbs "C:\Temp\patch.msp"
' cscript MsiExtractPatchXMLData.vbs "C:\Temp\patch.msp" > PatchXMLData.txt
On Error Resume Next
Dim ScriptArguments : Set ScriptArguments = WScript.Arguments
Dim NumberOfArguments : NumberOfArguments = ScriptArguments.Count
If NumberOfArguments <> 1 Then
WScript.Echo "Error: ERROR_INVALID_PARAMETER (An invalid parameter was passed to the function.)" & vbNewLine & vbNewLine _
& "Usage: [CScript | WScript] MsiExtractPatchXMLData.vbs <szPatchPath>" & vbNewLine _
& "Example: cscript MsiExtractPatchXMLData.vbs ""C:\Temp\patch.msp"""
WScript.Quit 1
End If
Dim szPatchPath : szPatchPath = WScript.Arguments(0)
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
If NOT FSO.FileExists(szPatchPath) Then
WScript.Echo "Error: ERROR_PATCH_OPEN_FAILED (The patch file could not be opened.)" & vbNewLine & vbNewLine _
& "Usage: [CScript | WScript] MsiExtractPatchXMLData.vbs <szPatchPath>" & vbNewLine _
& "Example: cscript MsiExtractPatchXMLData.vbs ""C:\Temp\patch.msp"""
WScript.Quit 1
End If
Dim FileExtension : FileExtension = StrReverse(Split(StrReverse(szPatchPath), ".", 2)(0))
If LCase(FileExtension) <> "msp" Then
WScript.Echo "Error: ERROR_PATCH_PACKAGE_INVALID (The patch file could not be opened.)" & vbNewLine & vbNewLine _
& "Usage: [CScript | WScript] MsiExtractPatchXMLData.vbs <szPatchPath>" & vbNewLine _
& "Example: cscript MsiExtractPatchXMLData.vbs ""C:\Temp\patch.msp"""
WScript.Quit 1
End If
Dim Installer : Set Installer = CreateObject("WindowsInstaller.Installer")
Dim szXMLData : szXMLData = Installer.ExtractPatchXMLData(szPatchPath )
WScript.Echo szXMLData
Dim xmlDoc : Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.LoadXml(szXMLData)
Set xmlRoot = xmlDoc.documentElement
PatchGUID = xmlRoot.Attributes.GetNamedItem("PatchGUID").Text
ProductCode = xmlRoot.getElementsByTagName("TargetProductCode").item(0).text
UpdatedVersion = xmlRoot.getElementsByTagName("UpdatedVersion").item(0).text
WScript.Echo "PatchGUID: " & PatchGUID & vbNewLine _
& "ProductCode: " & ProductCode & vbNewLine _
& "UpdatedVersion: " & UpdatedVersion
Thanks for the Script!
I ran it but couldn't seem to dump it to a .txt file. I've attached an image of the runtime messages that appeared.
Let me know and thanks for the effort!
cscript MsiExtractPatchXMLData.vbs "C:\Temp\patch.msp" > PatchXMLData.txt
Use the above from a dos console and it will pipe the output to the PatchXMLData.txt file in the current directory.
Here's what I get.
I'm guessing something is amiss...
It's a Small Update if that helps any.
Also, when I look at the little dummy installs I created, they don't have the MsiPatchMetadata table yet the Remove button is visible in ARP.
Hmmm ???
As EdT suggested, your answer is in the Windows Installer chm.
Do a search for "Uninstallable Patches".
more than likely this snippet applies to your case...
Would you like to reply?
Login or Register to post your comment.