根據卸載時的問題類型以及如何部署它,完全可以編寫腳本並部署它以編輯機器上緩存的MSI以解決問題。您可以遍歷C:\ Windows \ Installer \文件夾中的MSI以查找產品的一個(打開它們並讀取摘要信息)
一旦找到需要的那個,您可以修改表直接固定在你引入了任何問題(即禁止在卸載等自定義操作)下一次卸載被稱爲不會發生問題。
資源:
Windows Installer SQL Reference
Windows Installer Automation Interface Reference
包括示例腳本,我要指出,這主要是爲了說一個內部部署的應用程序不是真正的東西,你可以發送給客戶的修復,但其可能創建一個二進制文件做同樣的事情,並把它包含在說一個setup.exe,其中二進制揭開序幕先清理並刪除以前的卸載,然後放下新的,或者只是送出去的二進制修復卸載問題。
Option Explicit
Dim objFS, objShell
Dim objFolder, objFiles, objFile
Dim objInstaller
Dim installerPath, titleToFind
Dim queries
Const msiOpenDatabaseReadOnly = 0
Const msiOpenDatabaseTransact = 1
Set objInstaller = CreateObject("WindowsInstaller.Installer")
Set objShell = CreateObject("WScript.Shell")
installerPath = objShell.ExpandEnvironmentStrings("%SystemRoot%") & "\Installer\"
'Set the title you want to use for comparison
titleToFind = "Sample"
' Define the queries you wish to run against the database if found
queries = Array( "UPDATE `InstallExecuteSequence` SET `Condition` = 'NOT Installed' WHERE `Action` = 'SampleAction'", _
"DELETE FROM `InstallExecuteSequence` WHERE `Action` = 'SampleAction'")
Set objFS = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If (objFS.FolderExists(installerPath)) Then
Set objFolder = objFS.GetFolder(installerPath)
Set objFiles = objFolder.Files
For Each objFile in objFiles
If (StrComp (Right(objFile.Name, 4), ".msi") = 0) Then
If (CheckMSI (installerPath & objFile.Name, titleToFind)) Then
UpdateMSI (installerPath & objFile.name)
Exit For
End If
End If
Next
End If
Set objFS = Nothing
Set objShell = Nothing
Set objFile = Nothing
Set objFiles = Nothing
Set objFolder = Nothing
Set objInstaller = Nothing
' Check if the title in the MSI matches the one you are looking for
Function CheckMSI (msiPath, title)
Dim objDatabase, objSummary
Dim msiTitle
Set objDatabase = objInstaller.OpenDatabase (msiPath, msiOpenDatabaseReadOnly) : CheckError
Set objSummary = objDatabase.SummaryInformation(0)
msiTitle = objSummary.Property(2)
If (StrComp (msiTitle, title) = 0) Then
CheckMSI = true
Else
CheckMSI = false
End If
Set objSummary = Nothing
Set objDatabase = Nothing
End Function
' Loop though the queries specified above and execute them against the MSI
Function UpdateMSI (msiPath)
Dim objDatabase
Dim objView
Dim query
Set objDatabase = objInstaller.OpenDatabase(msiPath, msiOpenDatabaseTransact) : CheckError
For Each query in queries
Set objView = objDatabase.OpenView (query) : CheckError
objView.Execute : CheckError
Next
objDatabase.Commit
Set objView = Nothing
Set objDatabase = Nothing
End Function
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText
End If
Fail message
End Sub
Sub Fail (message)
WScript.Echo message
WScript.Quit 2
End Sub
任何鏈接或資源如何做到這一點? – Davy8 2009-05-01 15:10:05