MSXML 6SP2で SQL Server 2005 のセットアップが失敗

MSXML コア サービス 6.0 Service Pack 2 がインストールされていると、SQL Server 2005 のセットアップが失敗する
の情報が更新されて、パッチファイルがダウンロードできるようになりました。

該当する方は、あまりいないかもしれませんが、リリースが遅かったですね。

MSXML 6 Service Pack 2 (KB954459) -- 構成に失敗しました。 - 大人になったら肺呼吸


中身は、ZIPの自動解凍書庫で MSXML_~1.EXE 更にその中に、VBS(VBScript)とMSP(microsoftPatch)が入っています。

VBSでXPかどうか判定して、MSPを適用する仕組みになっているようです。

'msxml_fix.vbs
Dim objRegWMI, objWMIService, objShell, objWMIOS
Dim strCodeMSXML, strExec, strTempPath, strMSPPath
Dim PID
const HKLM = &H80000002
const OS = "5.1.2600"
const KeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
'const MSXMLName = "MSXML 6 Service Pack 2 (KB954459)"
const MSXMLName = "MSXML 6 Service Pack"
const MSPName = "\msxml6.msp"
const LOGFileName = "msxmlpatch.log"
On Error Resume Next

Set objWMIOS = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colResults = objWMIOS.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colResults
  strOSVer = objItem.Version
Next

if strOSVer = OS then
  Wscript.Echo "=> OS version = " & strOSVer
else
  Wscript.Echo "   Error: OS version = " & strOSVer & " expected = " & OS
  Wscript.Quit -1
end if

if not (objWMIOS is nothing) then set objWMIOS = nothing
if not (colResults is nothing) then set colResults = nothing

Set objShell = CreateObject("WScript.Shell")
strTempPath = objShell.ExpandEnvironmentStrings("%Temp%")
strMSPPath = objShell.CurrentDirectory & MSPName

if not (objShell is nothing) then set objShell = nothing
strCodeMSXML = ""
Set objRegWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objRegWMI.EnumKey HKLM, KeyPath, arrayRegKeys

For Each strKey in arrayRegKeys
  objRegWMI.GetStringValue HKLM, KeyPath & "\" & strKey, "DisplayName", strVal
  if InStr(strVal, MSXMLName) <> 0 then
    Wscript.Echo "=> Product code: " & strKey
    Wscript.Echo "=> Product name: " & strVal
    strCodeMSXML = strKey
  End If
Next

if not (objRegWMI is nothing) then set objRegWMI = nothing
if strCodeMSXML = "" Then
  Wscript.Echo "   Error: " & MSXMLName & " cannot be found"
  Wscript.Quit -1
end if

strExec = "MSIEXEC /X " & strCodeMSXML & " PATCH=""" & strMSPPath & """ /qn /l*v " & strTempPath & "\" & LOGFileName
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2:Win32_Process")
errReturn = objWMIService.Create(strExec, null, null, PID)

if not (objWMIService is nothing) then set objWMIService = nothing
if errReturn <> 0 Then
  Wscript.Echo "   Error: " & strExec
  Wscript.Quit -2
end if

Wscript.Echo "=> Command: " & strExec
Wscript.Echo "=> PID: " & PID

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessID = " & PID )

do while colProcesses.Count>0
  Wscript.Sleep(3000)
  Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessID = " & PID )
loop

if not (objWMIService is nothing) then set objWMIService = nothing
if not (colPprocesses is nothing) then set colPprocesses = nothing

strCodeMSXML = ""

Set objRegWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objRegWMI.EnumKey HKLM, KeyPath, arrayRegKeys
For Each strKey in arrayRegKeys
  objRegWMI.GetStringValue HKLM, KeyPath & "\" & strKey, "DisplayName", strVal
  if InStr(strVal, MSXMLName) <> 0 then
    strCodeMSXML = strKey
  End If
Next

if not (objRegWMI is nothing) then set objRegWMI = nothing
if strCodeMSXML = "" Then
  Wscript.Echo "=> " & MSXMLName & " has been uninstalled"
else
  Wscript.Echo "   Error: please check log file: " & strTempPath & "\" & LOGFileName
  WScript.Echo
  Wscript.Quit -3
end if

なんで、VBSなのかは謎です…。はて?

おすすめ

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です