Untested but'll you get the idea:

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") 
Set database = installer.OpenDatabase("c:\path\toyour\msifile.msi", 0)
query = "SELECT 'Value' FROM Property WHERE Property='ProductCode'"
Set view = database.OpenView(query) 
view.Execute
Set record = view.Fetch
WScript "ProductCode is " & record.StringData(1)


Best regards,
Sebastian Brand

Deployment consultant
E-Mail: sebast...@instyler.com

Instyler Setup - Creating WiX-based MSI installations, elegantly.
http://www.instyler.com

On 19.11.2009, at 11:42, Jiang, Chunyan (GE Healthcare) wrote:

> Hi Rob,
> 
> Thanks for your reply.
> 
> I got some information for other person that I can use
> MsiOpenDatabase/MsiViewExecute 
> 
> But I have no idea how to use it. Could you please give me some example?
> 
> Regards,
> 
> Chunyan
> 
> -----Ursprüngliche Nachricht-----
> Von: Rob Mensching [mailto:r...@robmensching.com] 
> Gesendet: Donnerstag, 19. November 2009 07:19
> An: General discussion for Windows Installer XML toolset.
> Betreff: Re: [WiX-users] How to retrieve ProductCode outside MSI
> 
> Outside the MSI you need to use the SQL statements to query the Property 
> table.
> 
> On Wed, Nov 18, 2009 at 7:26 AM, Jiang, Chunyan (GE Healthcare) < 
> chunyan.ji...@ge.com> wrote:
> 
>> Hi,
>> 
>> I developed one app.msi to intall one app. And I need to develop one 
>> bootstraper.exe to retrieve the ProductCode of previously installed app.
>> Since it is multiple instance installation, there will be more than 
>> one ProductCode.
>> 
>> I have used some MSI functions to retrieve the property when 
>> developing the installer with WiX, like:
>> ::MsiGetPropertyW(hInstaller,  L"PREVIOUSFOUND", ProductIDbuffer , 
>> &length1);
>> 
>> It is one custom action dll in WiX project. Here, MSIHANDLE hInstaller 
>> will pass the handle to the function. It is inside the MSI project. So 
>> it is easy. But how to get such handle outside the MSI project?
>> 
>> I found there is one function:
>> UINT MsiGetProductCode(
>> LPCTSTR szComponent,
>> LPTSTR lpProductBuf
>> );
>> 
>> It uses component code to retrieve product code. I have the component 
>> code in hand. However, there will be more installation, which use the 
>> same component code. Which one will be returned?
>> 
>> 
>> Could some one help me?
>> 
>> Chunyan
>> 
>> ----------------------------------------------------------------------
>> -------- Let Crystal Reports handle the reporting - Free Crystal 
>> Reports 2008 30-Day trial. Simplify your report design, integration 
>> and deployment - and focus on what you do best, core application 
>> coding. Discover what's new with Crystal Reports now.  
>> http://p.sf.net/sfu/bobj-july 
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>> 
>> 
> 
> 
> --
> virtually, Rob Mensching - http://RobMensching.com LLC
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with Crystal 
> Reports now.  http://p.sf.net/sfu/bobj-july 
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to