/build/static/layout/Breadcrumb_cap_w.png

MSI scripting

hi all,

i'm trying to generate a transform with a vbscript but i'm having troubles and i can't find info anywhere on this topic.

can someone gives me a link to some information please?

so far, i can export a table (property), update it with the changes i need, import it into a new msi, but when i generate the transform, only the property table is generated in the transform.

by the way, i'm using microsoft vbscripts to try this but nothing works so far.

thanks guys!

0 Comments   [ + ] Show comments

Answers (11)

Posted by: AngelD 16 years ago
Red Belt
0
so far, i can export a table (property), update it with the changes i need, import it into a new msi, but when i generate the transform, only the property table is generated in the transform.
So that seems correct.
The transform should/will only contain the diff between the two MSIs and as you only updated the Property table these entries will be added to the transform during generation using WiGenXfm.vbs (I guess you used this one).
Posted by: kardock 16 years ago
Second Degree Green Belt
0
ORIGINAL: AngelD

So that seems correct.
The transform should/will only contain the diff between the two MSIs and as you only updated the Property table these entries will be added to the transform during generation using WiGenXfm.vbs (I guess you used this one).



yes that's the vbs i use.

the transform is generated but when i try to open it with wise, after choosing the msi related to it, i have an error message starting with this;

"an invalid file handle was associated"

then if i open the msi with orca and apply the generated transform, i can see only the property table, all the other tables are marked as removed, with a green line that cross them.

i don't know how to fix this.

thanks for the help AngelD
Posted by: AngelD 16 years ago
Red Belt
0
Could you try using WiRunSQL.vbs instead to modify the Property table for the "updated" MSI.
Use INSERT to add new property entries and UPDATE to modify an existing entry.
Posted by: kardock 16 years ago
Second Degree Green Belt
0
i will definitely try it.

but could you tell me how to verify if the property is there or not?

i'm not sure which function to use depending if the property exists or not.

thanks!
Posted by: kardock 16 years ago
Second Degree Green Belt
0
hey AngelD, could you please give me an example to start me in the right direction?

if i use WIRunSQL.vbs, how can i update the property ALLUSERS for example?

i know nothing about sql queries :(

thanks man!
Posted by: AngelD 16 years ago
Red Belt
0
A simple vbscript for using either UPDATE or INSERT could look like
running the script bellow from the command prompt should be
cscript "<path to msi>" MyPropertyToAddOrChange "my property value"

PopulatePropertyTable.vbs
Const msiOpenDatabaseModeTransact = 1
Dim msiPath, propertyKey, propertyValue
Dim installer, database, view, record
msiPath = Wscript.Arguments(0)
propertyKey = Wscript.Arguments(1)
propertyValue = Wscript.Arguments(2)
Set installer = CreateObject("WindowsInstaller.Installer")
Set db = Installer.OpenDatabase(msiPath, msiOpenDatabaseModeTransact)
Set view = db.OpenView("SELECT * FROM `Property` WHERE `Property` = '" & propertyKey & "'")
view.Execute
Set record = view.Fetch
If Not (record Is Nothing) Then
Set view = db.OpenView("UPDATE Property SET Value = 'Updated " & propertyValue & "' WHERE Property = '" & propertyKey & "'")
Else
Set view = db.OpenView("INSERT INTO Property(Property.Property, Property.Value) VALUES('" & propertyKey & "', 'Added " & propertyValue & "')")
End If
view.Execute
db.Commit
Set installer = Nothing
Posted by: kardock 16 years ago
Second Degree Green Belt
0
AngelD, a big thank you!

i will study this script and i believe this will start me on how to work with vbs and msi!

thanks!
Posted by: kardock 16 years ago
Second Degree Green Belt
0
ok i have made some progress but i still have the original problem.

here is what i did;

i took my original msi file.
open the file with orca and made sure ALLUSERS was set to 1

i copied it to temp.msi

i have run the script to change ALLUSERS from 1 to 2, this works.
i checked with orca again and into temp.msi, ALLUSERS is set to 2.

then i use WiGenXfm.vbs to generate the transform, which also works.
WiGenXfm.vbs quicktime.msi temp.msi test.mst

then if i open the mst file with wfwi, i have this error;

first line: Could not apply transform to base database.
second line: An invalid file handle was associated with z:\projects\test\quicktime.msi

please help, if i can't fix this today i will have to stop working on this because too much time was involved now and i can't justify putting more hours in it.

thank you AngelD, you're always a big help to me!
Posted by: AngelD 16 years ago
Red Belt
0
First try to set ALLUSERS to 2 using ORCA for temp.msi and then see if you can create a transform with WiGenXfm.vbs.

You could always use the MsiTrans utility from the Platform SDK to generate a transform.
MsiTran.exe -g {base db} {new db} {transform}
So in you case the command line should look like: MsiTran.exe -g quicktime.msi temp.msi test.mst
Posted by: kardock 16 years ago
Second Degree Green Belt
0
MsiTran.exe -g quicktime.msi temp.msi test.mst

YES IT WORKS!

msitran.exe has done my mst and i can edit it with wfwi!

i can't thank you enough man!

now i will be able to make all this together and create the script i need.

thanks again AngelD.
Posted by: AngelD 16 years ago
Red Belt
0
You're welcome!
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ