Way to find patch installed?
[font="trebuchet ms"]Hi,
[font="trebuchet ms"]
[font="trebuchet ms"]I would required to find whether the patch is installed for a particular application.
[font="trebuchet ms"]I want to execute a script from a batch file based on the whether the patch is installed. Apart from ARP entry, is there a way to find the installed patch for an appl. programatically.
[font="trebuchet ms"]
[font="trebuchet ms"]Thanks
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
0 Comments
[ + ] Show comments
Answers (19)
Please log in to answer
Posted by:
anonymous_9363
16 years ago
Hastily cobbled together from a sample I d/l (sorry, I can't recall the source):
Const msiInstallContextUserManaged = 1 '// products that are under the managed context (deployed by GP)
Const msiInstallContextUserUnManaged = 2 '// products that are under the unmanaged context.
Const msiInstallContextMachine = 4 '// products that are under the machine account.
Dim strPatchCode
Dim strProductCode
Dim objPatch
strPatchCode = "{0DD140D3-9563-481E-AA75-BA457CBDAEF2}"
strProductCode = "{ADA0463D-8D47-4A3A-ADA7-B17B6209C295}"
Set objPatch = Installer.Patch(strPatchCode, strProductCode, "", msiInstallContextMachine)
MsgBox objPatch.State
Check out MSDN, anyway http://msdn.microsoft.com/en-us/library/aa370594(VS.85).aspx
Posted by:
getIT
16 years ago
[font="trebuchet ms"]Ian,
[font="trebuchet ms"]
[font="trebuchet ms"]I tried executing the VbS, but throws an exception on 'Installer.Patch' object could not be found.
[font="trebuchet ms"]Is there any registry updated from a small or minor patch in general??
[font="trebuchet ms"]
[font="trebuchet ms"]Thanks.
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
Posted by:
anonymous_9363
16 years ago
Well, I *did* say it was thrown together!
You *could* test all of this guff using bare registry entries but then you'd need to get into unpacking packed GUIDs, matching ProductCodes versus patches and so on. Not for the faint-hearted
I'm guessing that the error occurs because the patch with PatchCode 'strPatchCode' hasn't been applied to the product with ProductCode 'strProductCode'. You did substitute your own codes in there, didn't you? I figure if you look up 'PatchInfo' on MSDN, there might be a list of returned codes against which you could error-trap.
You *could* test all of this guff using bare registry entries but then you'd need to get into unpacking packed GUIDs, matching ProductCodes versus patches and so on. Not for the faint-hearted
I'm guessing that the error occurs because the patch with PatchCode 'strPatchCode' hasn't been applied to the product with ProductCode 'strProductCode'. You did substitute your own codes in there, didn't you? I figure if you look up 'PatchInfo' on MSDN, there might be a list of returned codes against which you could error-trap.
Posted by:
AngelD
16 years ago
Posted by:
getIT
16 years ago
[font="trebuchet ms"]Iam,
[font="trebuchet ms"]
[font="trebuchet ms"]I did test the script after applying the patch and making necessary modifications. I will have a look at MSDN and try getting it working.
[font="trebuchet ms"]
[font="trebuchet ms"]Kim,
[font="trebuchet ms"]I hope the link u sent would be really useful. I will try as per that and let you know.
[font="trebuchet ms"]
[font="trebuchet ms"]Thanks .
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
Posted by:
matrixtushar
16 years ago
Patch is a windows installer object, and therefore, the code will run if embedded inside an MSI or called as a custom action from the installation. Similar to other objects, the patch object also will throw an error if run directly through WScript or CScript engines.
Try embedding the code inside the MSI as a custom action and it surely will work.
regards,
tushar
Try embedding the code inside the MSI as a custom action and it surely will work.
regards,
tushar
Posted by:
AngelD
16 years ago
How about:
Dim ProductCode : ProductCode = "{90120000-0020-0409-0000-0000000FF1CE}"
Dim PatchCode : PatchCode = "{026C2636-B788-409C-B178-A7603289EC2A}"
Dim Installer : Set Installer = Nothing
Set Installer = CreateObject("WindowsInstaller.Installer")
Dim IsPatchInstalled : IsPatchInstalled = False
Dim PatchList : Set PatchList = Nothing
Set PatchList = Installer.Patches(ProductCode)
If PatchList.Count >= 1 Then
For index = 0 To PatchList.Count-1
If PatchList.Item(index) = PatchCode Then IsPatchInstalled = True
Next
End If
If IsPatchInstalled = False Then
WScript.Echo "Product: " & ProductCode & vbNewLine _
& "Patch has not been applied for this product"
End If
Set Session = Nothing
Set Installer = Nothing
Posted by:
getIT
16 years ago
Posted by:
anonymous_9363
16 years ago
Posted by:
AngelD
16 years ago
Posted by:
getIT
16 years ago
[font="trebuchet ms"]Ian,
[font="trebuchet ms"]
[font="trebuchet ms"]I hope, if i had worked on ur code also (to get rid of the error i got when running the VBS file), it would have helped me. Since i was in lack of time, i couldn't.
[font="trebuchet ms"]
[font="trebuchet ms"]Anyway Thanks Ian and Kim.
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
[font="trebuchet ms"]
Posted by:
AngelD
16 years ago
Posted by:
anonymous_9363
16 years ago
ORIGINAL: AngelDHad to, no choice. Not for the first time WPS's SetupCapture bombed in spectacular style on an app which writes lots and lots of registry stuff. I posted a bug report, of course, but I shall be in my box before Altiris get round to fixing it. Let's be honest, they're still working through bugs reported for 5.6...or ignoring them.
InstallShield? Judas [:D]
Needless to say, IS brought with it its own 'challenges', not the least of which being how much T I M E it spent building the MSI. You may have thought WPS was pedestrian? IS 2008 is in a different league. All right, I already said that this app was a clunker but 2.5 H O U R S to go from project state to MSI? And this was with JUST the VM running - I closed down EVERYTHING ELSE on the host. Yawnsville, Arizona. Still, it got the job done, where SetupCapture failed so...swings and roundabouts, I suppose.
Posted by:
PackageExpert
16 years ago
Posted by:
getIT
16 years ago
Posted by:
anonymous_9363
16 years ago
ORIGINAL: harjindHmmm...nice try but not a good idea, really, because it's not inconceivable that the file could have been replaced by some other process e.g. by installing the package which natively installs v2.1.0000.4500. It doesn't guarantee that the patch was applied.
usually patches will install greater file versions. <snip> and if found that means the patch is installed.
Posted by:
AngelD
16 years ago
ORIGINAL: VBScab
ORIGINAL: AngelDHad to, no choice. Not for the first time WPS's SetupCapture bombed in spectacular style on an app which writes lots and lots of registry stuff. I posted a bug report, of course, but I shall be in my box before Altiris get round to fixing it. Let's be honest, they're still working through bugs reported for 5.6...or ignoring them.
InstallShield? Judas [:D]
Needless to say, IS brought with it its own 'challenges', not the least of which being how much T I M E it spent building the MSI. You may have thought WPS was pedestrian? IS 2008 is in a different league. All right, I already said that this app was a clunker but 2.5 H O U R S to go from project state to MSI? And this was with JUST the VM running - I closed down EVERYTHING ELSE on the host. Yawnsville, Arizona. Still, it got the job done, where SetupCapture failed so...swings and roundabouts, I suppose.
No need to add some defense Ian as I already know your "Wise history".
I was just pulling your leg [:D]
Cheers!
Posted by:
anonymous_9363
16 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.