|
|
#1 (permalink) |
|
Guest
Posts: n/a
|
Hi all.
Found solution for this. Some description. 1. Key data integrated into msi in the stream named "AdminProperties" 2. Actual registry data persist in "DigitalProductID" key. Also you can find product key in PIDKEY There is simple script to extract this stream from msi: ' Windows Installer utility to extract "AdminProperties" from msi installation database Option Explicit Const msiOpenDatabaseModeReadOnly = 0 Const msiReadStreamAnsi = 2 ' Check arg count, and display help if argument not present or contains ? Dim argCount:argCount = Wscript.Arguments.Count If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0 If (argCount = 0) Then Wscript.Echo "Windows Installer 'AdminProperties' stream extractor" &_ vbNewLine & " 1st argument is the path to MSI database (installer package)" &_ vbNewLine & "Copyright (C) Fox. All rights reserved." Wscript.Quit 1 End If ' Connect to Windows Installer object On Error Resume Next Dim installer : Set installer = Nothing Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError ' Evaluate command-line arguments and set open and update modes Dim databasePath:databasePath = Wscript.Arguments(0) ' Open database and create a view on the _Streams table Dim database : Set database = installer.OpenDatabase(databasePath, msiOpenDatabaseModeReadOnly) : CheckError Dim sqlQuery : sqlQuery = "SELECT `Name`,`Data` FROM _Streams WHERE `Name` = 'AdminProperties'" Dim view : Set view = database.OpenView(sqlQuery) Dim record Dim message, name, Size, Data Dim objFileSystem, objOutputFile Dim strOutputFile ' generate a filename base on the script name strOutputFile = "./AdminProperties.txt" Set objFileSystem = CreateObject("Scripting.fileSystemObject") Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE) view.Execute : CheckError Set record = view.Fetch : CheckError If record Is not Nothing Then name = record.StringData(1) Size = record.DataSize(2) Wscript.Echo "Extracting " & name & " (" & CStr(Size) & ") bytes" Data = record.ReadStream(2, Size, msiReadStreamAnsi) objOutputFile.Write(Data) End If Wscript.Echo "Data extraction complete" objOutputFile.Close Sub CheckError Dim message, errRec If Err = 0 Then Exit Sub message = Err.Source & " " & Hex(Err) & ": " & Err.Description If Not installer Is Nothing Then Set errRec = installer.LastErrorRecord If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText End If Wscript.Echo message Wscript.Quit 2 End Sub usage: cscript Extract.vbs STD11.MSI After extraction you can clean DigitalProductID and PIDKEY and insert changed stream back into MSI using Microsoft msi automation sample script "Manage Binary Streams" (http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx) usage: cscript Streams.vbs STD11.MSI AdminProperties.txt AdminProperties > On Wednesday, July 18, 2007 1:56 PM y2 wrote: > We have 2 different licenses for Visio 2002 Standard SR1 for 2 different > subsidaries (both licenses are volume licenses). I want to create an admin > install with just one set of installation files and 2 MST files , one with > each license key - sounds pretty simple until you try it !! > > I created an admin install and used one of the license keys during this > admin install (for some reason I can't just create the admin install without > a license key and then enter it later when I create the MST file) then I > created an MST file using the ORK Custom Installation Wizard (the Office XP > version, not the Office 2003 version) but there's no option to enter a CD > Key. I've searched through the MSI using Orca but I can't see anywhere in > the properties table where it might be. I did read somehwere that the field > is PIDKEY, so I added PIDKEY with the 25 character product key as the value > (minus the hyphens inbetween) but it still uses the CD key that was used > during the admin install. I confirmed this by deploying to 2 PC's (one with > the MST file and one without) and they both show the same Product ID in Help > > Can anybody help me out with this as I'm at my witts end. I know I could > create two msi files but I don't really want to do this as we all share the > same domain, file server etc and are all in the same physical office. Also, > this would be 2 MSI files to keep patched up rather than one. > > Thanks in advance for any help anyone can give me >> On Thursday, July 19, 2007 3:32 AM Kalle Olavi Niemitalo wrote: >> y2k <y2k@discussions.microsoft.com> writes: >> >> >> It is probably in the AdminProperties stream, i.e. in the file >> but not in the database. I don't think Microsoft has documented >> the format of this stream. However, you may be able to prevent >> PIDKEY from being saved in that stream, by editing the >> AdminProperties property before you create the admin install. >> >> Alternatively, your transform could add custom actions that set >> the PIDKEY property. These would override the Property table, >> the AdminProperties stream, and the command line. >>> On Thursday, July 19, 2007 7:30 AM y2 wrote: >>> Thanks for the reply Kalle. >>> >>> Yea, I thought that maybe there was a stream too - but there's one only >>> entry in the media table: >>> >>> DiskID 1 >>> LastSequence 1 >>> DiskPrompt LABEL >>> >>> As far as I remember, if it was a stream it would start with # - is that >>> correct? >>> >>> Would would I need to change for AdminProperties property? At the moment it >>> says: >>> ProductID;PID;COMPANYNAME;DigitalProductID;PIDKEY; DPCADMIN;ACCEPTEULA >>> Do need to remove ProductID, PID, PIDKEY or a combination of !?!? >>> >>> the PIDKEY property >>> >>> By this I presume you mean add the PIDKEY property to the MSI? That's what >>> I tried doing, but it still uses the one that's (hidden !!) in the MSI. Or >>> have I missed out on something? >>> >>> Thanks again for your help >>> >>> "Kalle Olavi Niemitalo" wrote: >>>> On Thursday, July 19, 2007 6:55 PM Kalle Olavi Niemitalo wrote: >>>> y2k <y2k@discussions.microsoft.com> writes: >>>> >>>> >>>> A stream can exist without being listed in the Media table. >>>> >>>> >>>> I don't know. >>>> >>>> >>>> I meant, instead of adding PIDKEY directly to the Property table, >>>> add it to the CustomAction table and then make InstallUISequence >>>> and InstallExecuteSequence run that custom action. >>>> >>>> Custom Action Type 51: >>>> http://msdn2.microsoft.com/library/aa368237.aspx >>>>> On Monday, July 23, 2007 6:30 PM Owen Gilmore wrote: >>>>> It would not be in the MSI file. It probably would not work if you >>>>> entered it. It must be in the MST or command line. >>>>> >>>>> I did read somehwere that the field >>>>> >>>>> That is correct. >>>>> >>>>> I confirmed this by deploying to 2 PC's (one with >>>>> >>>>> ....good >>>>> >>>>> >>>>> Maybe I'm dense but I don't see what your problem is. You say you >>>>> installed the product and saw the correct license in help/about. So >>>>> what's the problem? >>>>>> On Tuesday, July 24, 2007 5:00 AM Brun wrote: >>>>>> Hi >>>>>> If you launch the install via setup.exe mentionning PIDKEY=*** in the >>>>>> command, it should override the original key. check the setup doc file for >>>>>> info. >>>>>> brgds >>>>>> >>>>>> >>>>>> "y2k" wrote: >>>>>>> On Tuesday, July 24, 2007 6:44 AM y2 wrote: >>>>>>> Thanks for the reply Owen, but I think you missed out ont he important part >>>>>>> of the post !!!! >>>>>>> >>>>>>> We have 2 different licenses for Visio 2002 Standard SR1 for 2 different >>>>>>> subsidaries (both licenses are volume licenses). I want to create an admin >>>>>>> install with just one set of installation files and 2 MST files , one with >>>>>>> each license key - sounds pretty simple until you try it !! >>>>>>> >>>>>>> >>>>>>> Like I said, I want to have 1 MSI file and 2 MST files - because I want to >>>>>>> deploy this using Group Policy. But the problem is that the installation is >>>>>>> always using the CD-KEY that I entered when creating the admin install - even >>>>>>> though I put PID in the mst file. It's definitely in the MSI file somewhere, >>>>>>> or at least being called by the MSI file because even if I double click it it >>>>>>> never gives me the opportunity to enter the CD-KEY. Any ideas of where it is >>>>>>> at all? >>>>>>> >>>>>>> "Owen Gilmore" wrote: >>>>>>>> On Tuesday, July 24, 2007 6:46 AM y2 wrote: >>>>>>>> Thanks for the reply Bruno, but I want to push this out with group policy so >>>>>>>> I need to use the MSI file rather than the .exe file. I still can't >>>>>>>> understand why MS make it so difficult to do this - if I'm only creating an >>>>>>>> admin install why do they insist that I enter a valid product key - why can't >>>>>>>> I just be given the opportunity to enter it into the MST file later on. >>>>>>>> >>>>>>>> "Bruno" wrote: >>>>>>>>> On Tuesday, July 24, 2007 7:08 AM y2 wrote: >>>>>>>>> Just thought I'd add one other thing - the product key is definitely >>>>>>>>> somehwere in the MSI file because even if I remove all of the other files >>>>>>>>> from the admin install point and run visio.msi it doesn't prompt for a key - >>>>>>>>> which means it's definitely in the MSI file somewhere. >>>>>>>>>> On Tuesday, July 24, 2007 11:58 AM Adrian Accinelli wrote: >>>>>>>>>> "y2k" <y2k@discussions.microsoft.com> wrote in message >>>>>>>>>> news:B38EFC91-B568-4E58-9B1D-7AFF0810359E@microsoft.com... >>>>>>>>>> >>>>>>>>>> If the property is included in the AdminProperties property prior to >>>>>>>>>> creating the administrative image then it will exist in a stream called >>>>>>>>>> AdminProperties. This stream contains a text file that is basically a >>>>>>>>>> single line of text that is made up of all the individual properties >>>>>>>>>> contained in the AdminProperties property as well their values at the end of >>>>>>>>>> the admin image install. E.g. AdminProperties=ABC;PIDKEY -> >>>>>>>>>> AdminProperties file stream will be: ABC="something" PIDKEY="somethingelse" >>>>>>>>>> IsAdminPackage="1" >>>>>>>>>> >>>>>>>>>> In the SDK, somewhere since I've lost track of where these guys move to now, >>>>>>>>>> there's a VBS script called wistream.vbs. Run this against your admin >>>>>>>>>> image and you'll see the AdminProperties stream. I don't think there's an >>>>>>>>>> extract in this script so you could modify the script to add that >>>>>>>>>> functionality and then use it to extract/edit/replace the file stream. >>>>>>>>>> Alternatively if you create a text file on your own with the necessary >>>>>>>>>> properties -- make sure you include IsAdminPackage="1" followed by a space >>>>>>>>>> at the end then you should be able to import your file overtop the existing >>>>>>>>>> AdminProperties stream without modifying the script. Either way you would >>>>>>>>>> remove all the preset PID values from the AdminProperties stream and thus >>>>>>>>>> allow your transform to do their work. >>>>>>>>>> >>>>>>>>>> You probably don't want to add the stream change into your transforms since >>>>>>>>>> then you wouldn't be able to use the transforms in a non-admin install >>>>>>>>>> scenario but that's another possibility -- this way regardless of which >>>>>>>>>> admin image you are dealing with the transform would make the necessary >>>>>>>>>> changes. >>>>>>>>>> >>>>>>>>>> Sincerely, >>>>>>>>>> Adrian Accinelli >>>>>>>>>>> On Tuesday, July 24, 2007 1:05 PM Owen Gilmore wrote: >>>>>>>>>>> On Jul 24, 3:44 am, y2k <y...@discussions.microsoft.com> wrote: >>>>>>>>>>> >>>>>>>>>>> Sorry, I did miss that part. AFAIK, you can't have the PIDKEY in the >>>>>>>>>>> MSI. At least that I've ever seen. >>>>>>>>>>> >>>>>>>>>>> It is strange that the admin install didn't prompt for a license >>>>>>>>>>> number. I also don't know if it's possible to apply a different >>>>>>>>>>> license # to the same admin install. Probably not useful to ask on a >>>>>>>>>>> public forum where your license number is. >>>>>>>>>>> >>>>>>>>>>> Methinks you need to give Microsoft a call and see if you have the >>>>>>>>>>> correct media and get your licenses squared away. >>>>>>>>>>> >>>>>>>>>>> Good luck >>>>>>>>>>> Owen >>>>>>>>>>>> On Wednesday, July 25, 2007 12:21 PM Kalle Olavi Niemitalo wrote: >>>>>>>>>>>> "Adrian Accinelli" <hclnospamalias2@newsgroup.nospam> writes: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Is it even possible to add a stream change into a transform? >>>>>>>>>>>> I thought transforms could only alter the database. >>>>>>>>>>>>> On Wednesday, July 25, 2007 5:18 PM Adrian Accinelli wrote: >>>>>>>>>>>>> "Kalle Olavi Niemitalo" <kon@iki.fi> wrote in message >>>>>>>>>>>>> news:87y7h4h2tn.fsf@Astalo.kon.iki.fi... >>>>>>>>>>>>> Good catch. I wasn't even thinking about that but your right. There has to >>>>>>>>>>>>> be a database field of object type in order for the transform to pickup a >>>>>>>>>>>>> stream change. Since _Streams table does not normally exist there would be >>>>>>>>>>>>> no TRANSFORM action INSERT/UPDATE/etc that would be applicable for an actual >>>>>>>>>>>>> stream change. >>>>>>>>>>>>> >>>>>>>>>>>>> Just to be certain I tried changing only the AdminProperties stream and >>>>>>>>>>>>> transform failed to create. Similarly changing some other Database values >>>>>>>>>>>>> did not provide stream changes. >>>>>>>>>>>>> >>>>>>>>>>>>> Well that certainly makes this a bit more painful to rollout to multiple >>>>>>>>>>>>> sites since each physical MSI would require modification. >>>>>>>>>>>>> >>>>>>>>>>>>> I suppose then it's easier to simply remove values you don't want in >>>>>>>>>>>>> AdminProperties stream from the AdminProperties value prior to creating the >>>>>>>>>>>>> administrative image. That change could be handled by a transform. >>>>>>>>>>>>> >>>>>>>>>>>>> Sincerely, >>>>>>>>>>>>> Adrian Accinelli >>>>>>>>>>>>>> On Thursday, July 26, 2007 4:15 AM Kalle Olavi Niemitalo wrote: >>>>>>>>>>>>>> "Adrian Accinelli" <hclnospamalias2@newsgroup.nospam> writes: >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> I see. If the stream were named "Admin.Properties", one could >>>>>>>>>>>>>> then define an "Admin" table, and binary data in a row with >>>>>>>>>>>>>> primary key "Properties" would map to that stream and provide >>>>>>>>>>>>>> a way to modify it via a transform. But there is no period in >>>>>>>>>>>>>> "AdminProperties". >>>>>>>>>>>>>> >>>>>>>>>>>>>> OLE Limitations on Streams (Windows) >>>>>>>>>>>>>> http://msdn2.microsoft.com/library/aa370551.aspx >>>>>>>>>>>>>> >>>>>>>>>>>>>> I wonder though if there is a documented way to directly >>>>>>>>>>>>>> construct a transform without comparing two databases, like >>>>>>>>>>>>>> MSITRANSFORM_ERROR_VIEWTRANSFORM allows a transform to be read >>>>>>>>>>>>>> without really applying it to a database. That or reverse >>>>>>>>>>>>>> engineering the file format would in principle make it possible >>>>>>>>>>>>>> to construct a transform that updates the _Streams table, but I >>>>>>>>>>>>>> am not at all sure Windows Installer would be able to apply such >>>>>>>>>>>>>> a transform: perhaps the _Streams pseudo-table is handled at a >>>>>>>>>>>>>> higher level that MsiDatabaseApplyTransform does not call. >>>>>>>>>>>>>>> On Monday, July 30, 2007 11:16 AM Adrian Accinelli wrote: >>>>>>>>>>>>>>> "Kalle Olavi Niemitalo" <kon@iki.fi> wrote in message >>>>>>>>>>>>>>> news:87sl7bh979.fsf@Astalo.kon.iki.fi... >>>>>>>>>>>>>>> Right - it's completely detached from the Database proper. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> I've never found anything documented about the internal format of the >>>>>>>>>>>>>>> transform although I'm sure someone has worked it out for whatever reason. >>>>>>>>>>>>>>> I have just assumed the transform was a single table and the OpenDatabase >>>>>>>>>>>>>>> api makes it difficult to open directly by changing header of file such that >>>>>>>>>>>>>>> it does not look like a regular MSI file. By making it difficult to roll >>>>>>>>>>>>>>> your own transform the Windows Installer developers are protecting >>>>>>>>>>>>>>> themselves against invalid transform actions which could compromise the >>>>>>>>>>>>>>> integrity of the service. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> I would be interesting to hear the story on this limitation though. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Sincerely, >>>>>>>>>>>>>>> Adrian Accinelli >>>>>>>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice >>>>>>>>>>>>>>> Store ASP.NET Site Visitor Stats in MongoDb >>>>>>>>>>>>>>> http://www.eggheadcafe.com/tutorials...n-mongodb.aspx |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|