D. G. Schneider Lions Club Volunteer Project

VB Script to Update on-the-fly any PCP or MSI Installer Database - PCP SQL Examples

Here are some command lines that will save you money and time (time is money!):

Related topics: msidb.exe,MSI Automation,MSI Tables Overview,Create MSI Tables,MSI UAC VISTA,MSI Error Table,BootStrapper VISTA,MSP VISTA, Install MSI SDK Tools V3.1.4 Create CAB File Build MSPs

Microsoft Windows Installer SDK offers a lot of samples VBScript like for example WiRunSQL.vbs.
I used WiRunSQL.vbs as a base to create UpdateMSIPCP.vbs which offers the capability to create a new guid if the the string PatchGUID is included on the command line.

Example how to run SQL Commands against a PCP:

WiRunSQL.vbs is script from the Microsoft Windows SDK Components for Windows Installer Developers.
See examples of SQL commands against a MSI

cscript WiRunSQL.vbs "Test.MSI" "UPDATE `Component` SET `Component`.`Attributes`= 264 WHERE `Component`.`Attributes`= 8"

The following command line will create a New GUID for the PCP installer database used to create the MSP patch:
Cscript UpdateMSIPCP.vbs DSCAN_EF.pcp "UPDATE `Properties` SET `Value`='PatchGUID' WHERE `Name`='PatchGUID'"

(The script UpdateMSIPCP.vbs will create a new GUID at the place of th string "PatchGUID". See the Function GUID below or more information how to create a new GUID)
The following command line will modify the Description value of the PCP installer database.

Cscript UpdateMSIPCP.vbs DSCAN_EF.pcp "UPDATE `PatchMetadata` SET `Value`='DSCAN EF Update' WHERE `Property`='Description'"

The following command line will modify the DisplayName value of the PCP installer database.
Cscript UpdateMSIPCP.vbs DSCAN_EF.pcp "UPDATE `PatchMetadata` SET `Value`='DSCAN EF Nucleus DB Update' WHERE `Property`='DisplayName'"

The following command line will modify the CreationTimeUTC value of the PCP installer database.
Cscript UpdateMSIPCP.vbs DSCAN_EF.pcp "UPDATE `PatchMetadata` SET `Value`='03-17-14 04:09' WHERE `Property`='CreationTimeUTC'"

Function to create a new GUID within the VB Script UpdateMSIPCP.vbs

Function GUID ()
    Set TypeLib = CreateObject("Scriptlet.TypeLib")
    GUID = TypeLib.Guid
    Pt = Instr(1, GUID, Chr(0))
    If Pt > 0 then GUID = left(GUID, (Pt - 1))
    GUID = cstr(GUID)
End Function

Microsoft Readme File delivered with Windows Installer SDK

Copyright (c) Microsoft Corporation. All rights reserved.
Windows Installer utility scripts for use with Windows Scripting Host

WiLstPrd.vbs - lists products, product properties, features, and components
WiImport.vbs - imports files to an MSI database
WiExport.vbs - exports files from an MSI database
WiSubStg.vbs - adds a transform or nested MSI as a substorage
WiStream.vbs - adds an external stream to a MSI package (e.g CAB file)
WiMerge.vbs - merges two MSI databases
WiGenXfm.vbs - generates a transform from two databases, or compares them
WiUseXfm.vbs - applies a transform to an MSI database
WiLstXfm.vbs - lists an MSI transform file (CSCRIPT only)
WiDiffDb.vbs - lists the differences between two databases (CSCRIPT only)
WiLstScr.vbs - lists an installer script file (CSCRIPT only)
WiSumInf.vbs - displays and updates summary information stream
WiPolicy.vbs - manages installer policy settings
WiLangId.vbs - reports and updates the language and codepage of a package
WiToAnsi.vbs - copies a Unicode text file to the same or a new Ansi text file
WiFilVer.vbs - updates File table sizes and versions from source file tree
WiMakCab.vbs - generates compressed file cabinets and updates package
WiRunSQL.vbs - executes SQL statements against an installer database
WiTextIn.vbs - copies an ANSI text file into a database string column value
WiCompon.vbs - lists components and their composition in an installer database
WiFeatur.vbs - lists features and their composition in an installer database
WiDialog.vbs - previews all or specified dialogs in an installer database

All scripts display help screens describing their command line arguments,
either if the first argument contains a ?, or if too few arguments are given.
Scripts return a value of 0 for success, 1 if help invoked, or 2 if failure.

Windows Scripting Host is actually two hosts, use //? to obtain help:
Cscript.exe displays to standard out - useful for batch files and build scripts Wscript.exe displays the output in a window - the default for extension .VBS When run from a Win NT DOS box, only the base name needs to be specified, and if the tools are on the PATH, then they will be found like EXE or BAT files. To redirect output to a file, you must use Cscript {scriptname}.VBS > {file}.

To download and install Windows Scripting Host (not required for Windows2000):
To download and update Windows scripting engines:

The utility makecab.exe is located in the Windows Installer SDK at \Patching\makecab.exe.

For more information about these samples, see the section "Windows Installer Scripting Examples" in the Windows Installer help files.

The rest is self-explanatory...

For more information:
Windows Vista - Unable to place file in stream, Replacing Non-versioned Files - UserData, ProgID table produces error during run time - Validation, Remove registry infoentries for all users in system or just owner?, MSM Validation - ATL.MSM, and more... seemy posts with ongroup:microsoft.public.platformsdk.msi

Tek-TipsForums member name dgschnei

Some keywords you can use to search topics: instmsiW.exe, orca, Msival2, darice

See more discussions and posts about MSI:
Replacing Non-versioned Files User Data with companion files
New tools to Import VBS JPG - Unable to place file in stream - MSIDB
MSM Validation - ATL.MSM - Documentation
Remove registry info entries for all users in system or just current owner
ARPPRODUCTICON OK for XP not for W2K Add/Remove Programs
Msidb Command Line Folder Path MSI name limitations
Do NOT Associate Extension set flag file types as No Open in Verb Table
Property for All Users Shared Documents or CA?
File Hidden Attribute after installation - Source in CAB files
260 characters limit in shortcut's targets Windows not MSI/Setup Limitation

Return Home - Index

About Dominique Gérard Schneider since 1995
Participation on Google on YouTube

Tek-Tips Forums dgschnei
Listed since 1996 ixquick
Community Services

platform sdk dgschnei
About Me

Tek-TipsForums, and platformsdk (member name dgschnei)