The AdvertiseScript method of the Installer object advertises an installation package.
Syntax
Script
AdvertiseScript(
scriptPath,
scriptFlags,
removeItems
)
Parameters
- scriptPath
-
The full path to the script file generated by the CreateAdvertiseScript method.
- scriptFlags
-
The flags that control the advertisement. This parameter can be a combination of the following values.
Value Meaning - msiAdvertiseScriptCacheInfo
- 0x001
Include this flag if the icons need to be created or removed.
- msiAdvertiseScriptShortcuts
- 0x004
Include this flag if the shortcuts need to be created or removed.
- msiAdvertiseScriptMachineAssign
- 0x008
Include this flag if the product is to be assigned to a computer.
- msiAdvertiseScriptConfigurationRegistration
- 0x020
Include this flag if the configuration and management information in the registry data needs to be written or removed.
- msiAdvertiseScriptValidateTransformList
- 0x040
Include this flag to force the validation of the transforms listed in the script against previously registered transforms for this product. Note that transform conflicts are detected using a string comparison that is case insensitive and are evaluated between per-user and per-machine installations across all installation contexts.
- msiAdvertiseScriptClassInfoRegistration
- 0x080
Include this flag if advertisement information in the registry related to COM classes needs to be written or removed.
- msiAdvertiseScriptExtensionInfoRegistration
- 0x100
Include this flag if advertisement information in the registry related to an extension needs to be written or removed.
- msiAdvertiseScriptAppInfo
- 0x180
Include this flag if the advertisement information in the registry needs to be written or removed.
- msiAdvertiseScriptRegData
- 0x1A0
Include this flag if the advertisement information in the registry needs to be written or removed.
- removeItems
-
TRUE if the specified items are to be removed instead of being created.
Return Value
This method does not return a value.Remarks
The AdvertiseScript method uses the MsiAdvertiseScript function. The use of the AdvertiseScript method requires that the script be running within a local system process.
Examples
The following example demonstrates the use of the AdvertiseScript method.
Dim installer
Set installer = CreateObject("WindowsInstaller.Installer")
' Advertise Simple package using an advertise script
' created by CreateAdvertiseScript Method
'
' Flags 424 indicate msiAdvertiseScriptMachineAssign, msiAdvertiseScriptRegData
Installer.AdvertiseScript "c:\scratch\simpletst\rtm\simple.aas", 424, false
' Verify Simple is installed
MsgBox Installer.ProductState("{BAE98781-CF88-4309-8E2D-3D8B347F5B53}")
'
' Remove Simple using advertise script
'
Installer.AdvertiseScript "c:\scratch\simpletst\rtm\simple.aas", 424, true
' Verify simple is removed
MsgBox Installer.ProductState("{BAE98781-CF88-4309-8E2D-3D8B347F5B53}")
Requirements
Version | Windows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer 4.5 on Windows Server 2003 and Windows XP |
---|---|
DLL | Msi.dll |
IID | IID_IInstaller is defined as 000C1090-0000-0000-C000-000000000046 |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.