Windows Installer Scripting Examples
The Windows SDK Components for Windows Installer Developers contains VBScript files that show you how the Windows Installer automation interface is used to modify Windows Installer packages.
The script samples identified in this topic are not supported by Microsoft Corporation, and they are provided only as a potentially useful reference. Running these samples requires the Windows Script Host. For more information about Windows Script Host, see the Windows Script Host section of the Microsoft Windows Software Development Kit (SDK).
Sample Script File | Description |
---|---|
WiLstPrd.vbs | List Products, Properties, Features, and Components |
WiImport.vbs | Import Files |
WiExport.vbs | Export Files |
WiSubStg.vbs | Manage Substorages |
WiStream.vbs | Manage Binary Streams |
WiMerge.vbs | Merge Two Databases |
WiGenXfm.vbs | Generate a Transform |
WiUseXfm.vbs | Apply a Transform |
WiLstXfm.vbs | View a Transform (CSCRIPT only) |
WiDiffDb.vbs | View Differences Between Two Databases (CSCRIPT only) |
WiLstScr.vbs | View Installer Script (CSCRIPT only) |
WiSumInf.vbs | Manage Summary Information |
WiPolicy.vbs | Manage Policy Settings |
WiLangId.vbs | Manage Language and Codepage |
WiToAnsi.vbs | Copy a Unicode File to an Ansi File |
WiFilVer.vbs | Manage File Sizes and Versions |
WiMakCab.vbs | Generate File Cabinet |
WiRunSQL.vbs | Execute SQL Statements |
WiTextIn.vbs | Copy ANSI File Into a Database Field |
WiCompon.vbs | List Components |
WiFeatur.vbs | List Features |
WiDialog.vbs | Preview User Interface |
All these scripts display a help screen that describes their command line arguments. To display the help screen in Windows double-click the file. To display the help screen from a command line enter a ? as the first argument, or enter fewer arguments than required. Scripts return a value of 0 for success, 1 if help is invoked, and 2 if in case of failure.
These samples require Windows Script Host to run. Windows Script Host is actually two hosts:
Command-Line Options
The executable program that interprets packages and installs products is Msiexec.exe. Note that Msiexec also sets an error level on return that corresponds to system error codes. Command-line options are case-insensitive.
The command-line options in the following table are available with Windows Installer 3.0 and earlier versions. The Standard Installer Command-Line Options are also available beginning with Windows Installer 3.0.
Option | Parameters | Meaning | |
---|---|---|---|
/I | Package|ProductCode | Installs or configures a product. | |
/f | [p|o|e|d|c|a|u|m|s|v] Package|ProductCode | Repairs a product. This option ignores any property values entered on the command line. The default argument list for this option is ‘omus.’ This option shares the same argument list as the REINSTALLMODE property. p — Reinstalls only if file is missing. o — Reinstalls if file is missing or an older version is installed. e — Reinstalls if file is missing or an equal or older version is installed. d — Reinstalls if file is missing or a different version is installed. c — Reinstalls if file is missing or the stored checksum does not match the calculated value. Only repairs files that have msidbFileAttributesChecksum in the Attributes column of the File table. a — Forces all files to be reinstalled. u — Rewrites all required user-specific registry entries. m — Rewrites all required computer-specific registry entries. s — Overwrites all existing shortcuts. v — Runs from source and re-caches the local package. Do not use the v reinstall option for the first installation of an application or feature. | |
/a | Package | Administrative installation option. Installs a product on the network. | |
/x | Package|ProductCode | Uninstalls a product. | |
/j | [u|m]Packageor [u|m]Package/tTransform List or [u|m]Package/gLanguageID | Advertises a product. This option ignores any property values entered on the command line. u — Advertises to the current user. m — Advertises to all users of machine. g — Language identifier. t — Applies transform to advertised package. | |
/L | [i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] Logfile | Writes logging information into a logfile at the specified existing path. The path to the logfile location must already exist. The installer does not create the directory structure for the logfile. Flags indicate which information to log. If no flags are specified, the default is ‘iwearmo.’ i — Status messages. w — Nonfatal warnings. e — All error messages. a — Start up of actions. r — Action-specific records. u — User requests. c — Initial UI parameters. m — Out-of-memory or fatal exit information. o — Out-of-disk-space messages. p — Terminal properties. v — Verbose output. x — Extra debugging information. Windows Installer 2.0: Not supported. The x option is available with Windows Installer version 3.0.3790.2180 and later. + — Append to existing file.
| Generates an SMS status .mif file. Must be used with either the install (-i), remove (-x), administrative installation (-a), or reinstall (-f) options. The ISMIF32.DLL is installed as part of SMS and must be on the path. The fields of the status mif file are filled with the following information: Manufacturer — Author Product — Revision Number Version — Subject Locale — Template Serial Number — not set Installation — set by ISMIF32.DLL to «DateTime» InstallStatus — «Success» or «Failed» Description — Error messages in the following order: 1) Error messages generated by installer. 2) Resource from Msi.dll if installation could not commence or user exit. 3) System error message file. 4) Formatted message: «Installer error %i», where %i is error returned from Msi.dll. |
/p | PatchPackage[;patchPackage2 ] | Applies a patch. To apply a patch to an installed administrative image you must combine the following options: /p Advertises a new instance of the product. Must be used in conjunction with /t. Available starting with the Windows Installer version that is shipped with Windows Server 2003 and Windows XP with Service Pack 1 (SP1). | |
/n | ProductCode | Specifies a particular instance of the product. Used to identify an instance installed using the multiple instance support through a product code changing transforms. Available starting with the Windows Installer version shipped with Windows Server 2003 and Windows XP with SP1. |
The options /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, /p, /y and /z should not be used together. The one exception to this rule is that patching an administrative installation requires using both /p and /a. The options /t, /c and /g should only be used with /j. The options /l and /q can be used with /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, and /p. The option /n can be used with /i, /f, /x and /p.
To install a product from A:\Example.msi, install the product as follows:
msiexec /i A:\Example.msi
Only public properties can be modified using the command line. All property names on the command line are interpreted as uppercase but the value retains case sensitivity. If you enter MyProperty at a command line, the installer overrides the value of MYPROPERTY and not the value of MyProperty in the Property table. For more information, see About Properties.
To install a product with PROPERTY set to VALUE, use the following syntax on the command line. You can put the property anywhere except between an option and its argument.
msiexec /i A:\Example.msi PROPERTY=VALUE
msiexec /i PROPERTY=VALUE A:\Example.msi
Property values that are literal strings must be enclosed in quotation marks. Include any white spaces in the string between the marks.
msiexec /i A:\Example.msi PROPERTY=»Embedded White Space»
To clear a public property by using the command line, set its value to an empty string.
msiexec /i A:\Example.msi PROPERTY=»»
For sections of text set apart by literal quotation marks, enclose the section with a second pair of quotation marks.
msiexec /i A:\Example.msi PROPERTY=»Embedded «»Quotes»» White Space»
The following example shows a complicated command line.
msiexec /i testdb.msi INSTALLLEVEL=3 /l* msi.log COMPANYNAME=»Acme «»Widgets»» and «»Gizmos.»»»
The following example shows advertisement options. Note that switches are not case-sensitive.
msiexec /JM msisample.msi /T transform.mst /LIME logfile.txt
The following example shows you how to install a new instance of a product to be advertised. This product is authored to support multiple instance transforms.
msiexec /JM msisample.msi /T :instance1.mst;customization.mst /c /LIME logfile.txt
The following example shows how to patch an instance of a product that is installed using multiple instance transforms.
msiexec /p msipatch.msp;msipatch2.msp /n <00000001-0002-0000-0000-624474736554>/qb
When you apply patches to a specific product, the /i and /p options cannot be specified together in a command line. In this case, you can apply patches to a product as follows.
msiexec /i A:\Example.msi PATCH=msipatch.msp;msipatch2.msp /qb
The PATCH property cannot be set in a command line, when /p option is used. If the PATCH property is set when the /p option is used, the value of PATCH property is ignored and overwritten.
Command line windows installer version
Сообщения: 132
Благодарности: 11
Конфигурация компьютера |
Материнская плата: Gigabyte GA-945PL-S3 |
HDD: Seagate 250GB 7200rpm 8MB STM3250820AS SATAII |
Звук: Realtek ALC888/S/T @ Intel 82801GB ICH7 |
CD/DVD: LG GSA-H58N DVD/RW |
ОС: Старушка XP3 |
——-
Программное обеспечение сродни любви, лучше, когда оно бесплатное.
Конфигурация компьютера |
Материнская плата: Asus P8P67 |
HDD: 1 Тб |
Звук: Интегрированная |
CD/DVD: DVD читающий/пишущий |
ОС: Windows 7 Home Premium x64 |
Конфигурация компьютера |
Материнская плата: Asus P8P67 |
HDD: 1 Тб |
Звук: Интегрированная |
CD/DVD: DVD читающий/пишущий |
ОС: Windows 7 Home Premium x64 |
параметры конфигурации для NOD32 » |
Последний раз редактировалось Котяра, 23-05-2008 в 21:34 . Причина: опечатки
какой будет правильный синтаксис команды, чтобы можно было указать MSI-шному инсталятору использовать конфиг-файл. » |
Это сообщение посчитали полезным следующие участники:
Конфигурация компьютера |
ОС: Windows 10 Pro x64 Release Preview |
какой будет правильный синтаксис команды, чтобы можно было указать MSI-шному инсталятору использовать конфиг-файл. » |
Для этого нужно использовать свойство TRANSFORMS и указывать путь к файлу преобразования. Например,
——-
Канал Windows 10, etc | Чат @winsiders
Это сообщение посчитали полезным следующие участники: