Share via


Installer::AdvertiseScript 方法

Installer物件的AdvertiseScript方法會公告安裝套件。

語法

.AdvertiseScript(
  scriptPath,
  scriptFlags,
  removeItems
)

參數

scriptPath

CreateAdvertiseScript方法所產生的腳本檔案完整路徑。

scriptFlags

控制公告的旗標。 此參數可以是下列值的組合。

意義
msiAdvertiseScriptCacheInfo
0x001
如果需要建立或移除圖示,請包含此旗標。
msiAdvertiseScriptShortcuts
0x004
如果需要建立或移除快捷方式,請包含此旗標。
msiAdvertiseScriptMachineAssign
0x008
如果要將產品指派給電腦,請包含此旗標。
msiAdvertiseScriptConfigurationRegistration
0x020
如果需要寫入或移除登錄資料中的組態和管理資訊,請包含此旗標。
msiAdvertiseScriptValidateTransformList
0x040
包含此旗標,以針對此產品的先前註冊轉換,強制驗證腳本中所列的轉換。 請注意,轉換衝突是使用不區分大小寫的字串比較來偵測,而且會在所有 安裝內容的每一使用者與每部電腦安裝之間進行評估。
msiAdvertiseScriptClassInfoRegistration
0x080
如果需要寫入或移除與 COM 類別相關的登錄中的公告資訊,請包含此旗標。
msiAdvertiseScriptExtensionInfoRegistration
0x100
如果需要寫入或移除與擴充功能相關的登錄中公告資訊,請包含此旗標。
msiAdvertiseScriptAppInfo
0x180
如果需要寫入或移除登錄中的廣告資訊,請包含此旗標。
msiAdvertiseScriptRegData
0x1A0
如果需要寫入或移除登錄中的廣告資訊,請包含此旗標。

 

removeItems

如果要移除指定的專案,而不是建立,則為 TRUE。

傳回值

這個方法不會傳回值。

備註

AdvertiseScript方法會使用MsiAdvertiseScript函式。 使用 AdvertiseScript 方法需要腳本在本機系統進程內執行。

範例

下列範例示範使用 AdvertiseScript 方法。

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}")

規格需求

需求
版本
Windows Server 2012、Windows 8、Windows Server 2008 R2 或 Windows 7 上的 Windows Installer 5.0。 Windows Server 2008 或 Windows Vista 上的 Windows Installer 4.0 或 Windows Installer 4.5。 Windows Server 2003 和 Windows XP 上的 Windows Installer 4.5
DLL
Msi.dll
IID
IID_IInstaller定義為 000C1090-0000-0000-C000-000000000046

另請參閱

安裝程式

Windows Installer 3.1 和舊版不支援