我試圖使用Powershell修改MSI文件的內容。爲此,我創建一個WindowsInstaller.Installer的實例,然後使用$ installer.OpenDatabase和$ database.OpenView。類似的功能在VBScript中起作用,並且我看到在線示例似乎可以正常工作。PowerShell Windows安裝程序Com對象
$installer = new-object -comobject "WindowsInstaller.Installer"
$database = $installer.OpenDatabase("C:\Temp\Setup.msi", 1)
對於上面的代碼中,我得到一個錯誤「方法的調用失敗,因爲[系統.__ ComObject]不包含名爲‘的openDatabase’的方法。」
$installer = new-object -comobject "WindowsInstaller.Installer"
$database = $installer.InvokeMethod("OpenDatabase","C:\Temp\Setup.msi", 1)
如果我試圖$ installer.InvokeMethod我得到同樣的錯誤使用「方法調用失敗,因爲[系統.__ ComObject]不包含名爲‘的InvokeMethod’的方法。」
任何幫助將不勝感激。
謝謝。
的博客文章鏈接到從出現該頁面將消失(在Windows Live空間不存在,錯誤頁說: )。有沒有人記得它說的解決方法? – Vimes 2011-06-27 17:12:09