Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Retrieve UpgradeCode in CA


6 replies to this topic

AntonS

AntonS
  • Full Members
  • 94 posts

Posted 02 October 2004 - 15:30

Hello!

I eliminate that simultaneously can exist only one session object in install.

Session object provide some handy opportunities.

Next code written in VBScript will show UpgradeCode values for every product, installed in target system:

CODE
  Dim oInstaller, sProduct, oSession

Set oInstaller = CreateObject(“WindowsInstaller.Installer”)

  For each sProduct in oInstaller.Products

      Set oSession = oInstaller.OpenProduct(sProduct)

      MsgBox oSession.ProductProperty(“UpgradeCode”)

  Next


But how I can retrieve it from CA?


Sincerely your,
Anton Spitsyn
http://www.installsite.ru

AntonS

AntonS
  • Full Members
  • 94 posts

Posted 04 October 2004 - 11:02

It’s simple to receive ProductCode value.

Automation interface provide

I can perform it with code:

CODE
Dim oInstaller, sProduct

Set oInstaller = CreateObject(“WindowsInstaller.Installer”)

 For each sProduct in oInstaller.Products

     MsgBox oInstaller.ProductInfo(sProdCode,"InstalledProductName")

Next


Where "InstalledProductName" is specified attribute, which provide ProductName.

Can I receive UpgradeCode without Session object?

Sincerely your,
Anton Spitsyn
http://www.installsite.ru

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 October 2004 - 08:03

I don't think the upgrade code gets registered in the installer info similar to the product code for installed products. I guess you would have to open the MSI and read the contents of the property table.

AntonS

AntonS
  • Full Members
  • 94 posts

Posted 05 October 2004 - 11:40

But what I shall do if previous MSI file not available on target system?

I still can acquire UpgradeCode from Automation Interface by Session.PropertyName("UpgradeCode").

Thereby, UpgradeCode value stored somewhere in Windows Installer repository on target computer.

I suppose it possible to access UpgradeCode in this repository directly?

Thank you.

Sincerely your,
Anton Spitsyn
http://www.installsite.ru

AntonS

AntonS
  • Full Members
  • 94 posts

Posted 05 October 2004 - 12:03

Problem I work on state, that I never know UpgradeCode before my MSI arrive at target computers.
Sincerely your,
Anton Spitsyn
http://www.installsite.ru

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 October 2004 - 12:14

Calling Session.PropertyName("UpgradeCode") in a custom action will give you the value of the UpgradeCode property of the running install,not of any other msi file on the machine. But if the setup isn't running and you don't have a session, you can't get property values this way. Instead I believe you would have to use Installer SQL to read the UpgradeCode property from the Property table in the msi file.

AntonS

AntonS
  • Full Members
  • 94 posts

Posted 05 October 2004 - 12:48

Thank you.

I hope MSI 3.0 provided with functionality that allow avoiding this limitation.
Sincerely your,
Anton Spitsyn
http://www.installsite.ru