You are currently offline, waiting for your internet to reconnect

How to restore the missing Windows Installer cache files and resolve problems that occur during a SQL Server update

Extended support for SQL Server 2005 ends on April 12, 2016

If you are still running SQL Server 2005 after April 12, 2016, you will no longer receive security updates and technical support. We recommend upgrading to SQL Server 2014 and Azure SQL Database to achieve breakthrough performance, maintain security and compliance, and optimize your data platform infrastructure. Learn more about the options for upgrading from SQL Server 2005 to a supported version here.

Symptoms
The process that's described in this article provides emergency relief only and not a permanent fix. Customers who use this emergency process should validate their Windows Installer Cache using the Windows Installer Cache Verifier Package, as directed in KB article 2667628.

When you try to install a Microsoft SQL Server service pack or a cumulative update, you may encounter the following error messages, and these may indicate Windows Installer Cache problems. The Windows Installer Cache, located in c:\windows\installer folder, stores important files for applications installed using the Windows Installer technology and should not be deleted. If the installer cache has been compromised, you may not immediately see problems until you perform an action such as uninstall, repair, or update SQL Server.

When you install SQL Server, the Windows Installer stores critical files in the Windows Installer Cache (default is C:\Windows\Installer). These files are required for uninstalling and updating applications. Missing files cannot be copied between computers, because they are unique.

Microsoft recommends that for SQL Server installations you first use the repair process that's described in the following articles to verify your current installation:

You should run the repair from the original installation media, using the following command line:

setup.exe /ACTION=REPAIR /INDICATEPROGRESS=TRUE

Repair the common shared components and features first, and then repeat the command to repair the instances installed. During the repair process, the setup dialog box disappears. As long as the progress window does not show an error, the repair process is proceeding as expected.

Note The following error messages can be found as text messages in the event log or in the Setup logs that are located in one of the following folders, and they indicate that you should repair your affected instance being proceeding further:
  • For SQL Server 2008 and for SQL Server 2008 R2:
    C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap
  • For SQL Server 2012:
    C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap
For SQL 2005 (all branches)
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2005
1636 Unable to install Windows Installer MSI file
1636 Unable to install Windows Installer MSP file
Note You must review the setup log files to identify whether any cache files are missing. For more information about how to do this, go to the "Resolution" section.

For SQL Server 2008 SP1
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2008 SP1No error message
TITLE: SQL Server Setup failure.
------------------------------
SQL Server Setup has encountered the following error: The patch file cannot be opened. The file is: c:\WINNT\Installer\1cf506f.msp. Error code 0x84B20001.
------------------------------
For SQL Server 2008 SP3 build-only (CU/GDR branches are not applicable)
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2008 SP3
The cached MSI file 'C:\Windows\Installer\2775c8.msi' is missing. Its original file is 'sql_engine_core_inst.msi' and it was installed for product 'Microsoft SQL Server 2008 Database Engine Services' from '<network path>', version '10.3.5500.0', language 'ENU'.
The cached patch file "C:\Windows\Installer\19b19196.msp" is missing. The original file for this cached file is "sql_engine_core_inst.msp", which can be installed from "Service Pack 3 for SQL Server 2008 (KB2546951) (64-bit)", version 10.3.5500.0
Note You receive the following error message when you perform an upgrade:
SQL Server error

For SQL Server 2008 R2 SP1 only (CU/GDR branches are not applicable)
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2008 R2 SP1
TITLE: SQL Server Setup failure.
------------------------------
SQL Server Setup has encountered the following error: C:\Windows\Installer\932b909.msi.
------------------------------
The cached patch file "C:\Windows\Installer\105441.msp" is missing. The original file for this cached file is "sql_engine_core_inst_loc.msp", which can be installed from "Service Pack 1 for SQL Server 2008 R2 (KB2528583) (64-bit)", version 10.51.2500.0.
Note You receive the following error message when you perform an upgrade:
SQL Server error

For SQL Server 2008 R2 SP2
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2008 R2 SP1
The cached MSI file 'C:\Windows\Installer\932b909.msi' is missing. Its original file is 'sql_engine_core_inst.msi' and it was installed for product 'SQL Server 2008 R2 SP1 Database Engine Services' from '<network path>', version '10.51.2500.0', language 'ENU'.
The cached patch file "C:\Windows\Installer\105441.msp" is missing. The original file for this cached file is "sql_engine_core_inst_loc.msp", which can be installed from "Service Pack 1 for SQL Server 2008 R2 (KB2528583) (64-bit)", version 10.51.2500.0.
Note You receive the following error message when you perform an upgrade:
SQL Server error

For SQL Server 2012 prior to CU2
There is no message for missing MSP or MSI files. However, error code 1714 is logged in the Setup log.

In the Summary.txt file:
Component name: SQL Server Setup Support Files
Component error code: 1714

In the Detail.txt file:
<Date><Time>Slp: Sco: File 'd:\2d5feb4dd893c4adee47f15661ac\1033_ENU_LP\x64\setup\sqlsupport_msi\x64\SqlSupport.msi' does not exist
<Date><Time>Slp: Sco: File 'd:\2d5feb4dd893c4adee47f15661ac\1033_ENU_LP\x64\setup\sqlsupport_msi\x64\SqlSupport.msi' does not exist
<Date><Time>Slp: Checkpoint: PREINSTALL_SQLSUPPORT_CPU64_ACTION
<Date><Time>Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine <Server Name>
<Date><Time>Slp: Sco: Attempting to open registry subkey Software\Microsoft\Windows\CurrentVersion\Installer
<Date><Time>Slp: Sco: Attempting to get registry value InstallerLocation
<Date><Time>Slp: Windows installer version : 5.0.7601.17514
<Date><Time>Slp: Sco: Waiting for service 'msiserver' to accept the stop request.
<Date><Time>Slp: Sco: Attempting to open SC Manager
<Date><Time>Slp: Sco: Attempting to open service handle for service msiserver
<Date><Time>Slp: Invoking QueryServiceStatus Win32 API
<Date><Time>Slp: Sco: Attempting to close service handle for service msiserver
<Date><Time>Slp: Sco: Attempting to close SC Manager
<Date><Time> Slp: Target package: "d:\2d5feb4dd893c4adee47f15661ac\1033_ENU_LP\x64\setup\sqlsupport_msi\SqlSupport.msi"
<Date><Time> Slp: MSI Error: 1714 The older version of Microsoft SQL Server 2012 Setup (English) cannot be removed. Contact your technical support group.
<Date><Time> Slp: InstallPackage: MsiInstallProduct returned the result code 1603.
<Date><Time> Slp: Using MSI error code to detect the retry option: 1714
<Date><Time> Slp: No retry-able MSI return code detected.

For SQL Server 2012 CU2 (and any subsequent CU or SP)
Product VersionError Message when the Installer Package (MSI) is missing Error Message when the Installer Cache Package (MSP) is missing
SQL Server 2008 R2 SP1
The cached MSI file 'C:\Windows\Installer\<file_encoded_name>.msi' is missing. Its original file is ''C:\Windows\Installer\sql_<featurename>.msi' }' and it was installed for product 'Microsoft SQL Server <version>' from 'C:\originalfolder', version '<versionnumber>', language '<language>'.
The cached patch file "c:\Windows\Installer\1fdb1aec.msp" is missing. Its original file is "sql_engine_core_inst.msp", which can be installed from "Hotfix 2316 for SQL Server 2012 (KB2679368) (64-bit)", version 11.00.2100.60.The cached patch file “C:\Windows\Installer\<file_encoded_name>.msp' is missing. Its original file is ''C:\Windows\Installer\sql_<featurename>.msp' }', which can be installed from ‘Hotfix <number> for SQL Server 2012 <KB number>’, version '<versionnumber>'.
Note Under certain conditions in SQL Server 2012, RTM media may not be registered correctly. When you uninstall a cumulative update or a service pack under those circumstances, setup may prompt you for RTM media. To work around this issue, provide the RTM media path during the patch removal process.
Cause
These problems may occur when the Windows Installer database file (.msi) or the Windows Installer patch file (.msp) is missing from the Windows Installer cache. The Windows Installer cache is located in the following folder:
%windir%\installer
When a product is installed by using Windows Installer, a stripped version of the original .msi file is stored in the Windows Installer cache. Every update to the product such as a hotfix, a cumulative update, or a service pack setup, also stores the relevant .msp or .msi file in the Windows Installer cache.

Any future update to the product such as a hotfix, a cumulative update, or a service pack setup, relies on the information in the files that are stored in the Windows Installer cache. Without this information, the new update cannot perform the required transformations.
Resolution
To resolve these problems, use one of the following procedures.

Procedure 1: Use a script

To complete the steps in this procedure, you have to copy the FindSQLInstalls.vbs script from the "More Information" section to a local folder on the computer where you are trying to update your SQL Server installation.

Note The FindSQLInstalls.vbs script collects the information to correct invalid package paths. And, this script is used against the source locations to make sure that all MSP packages are in the Windows Installer cache directory. Any missing packages will be re-added if the original source media is available.

To resolve these problems by using a script, follow these steps:
  1. Locate the directory to which you saved the script content.
  2. Open an elevated command prompt to the directory to which you saved the script, and run the following command:
    Cscript FindSQLInstalls.vbs %computername%_sql_install_details.txt
  3. Open the file from step 2 in a text editor such as Notepad, and identify the problems that are causing the failure. To do this, search the text file for string patterns such as the following:
    • do not
    • !!!
  4. Based on the results in step 3, take the steps that are required.

    Note Look for more information about these steps in the "Examples" section.

  5. Repeat steps 2 through 4 until the text file that is created in step 2 no longer contains text that references invalid paths or missing files for the component that is being updated.

Examples

The following examples are entries and explanations of actions that are outlined in the output file that is generated when you run the FindSQLInstalls.vbs script.

Example 1: Missing installer files
The following is an example of the output that is generated when you are missing an .msi package in the Windows Installer cache folder.
================================================================================PRODUCT NAME   : Microsoft SQL Server 2008 Database Engine Services================================================================================  Product Code: {9FFAE13C-6160-4DD0-A67A-DAC5994F81BD}  Version     : 10.2.4000.0  Most Current Install Date: 20110211  Target Install Location:   Registry Path:    HKEY_CLASSES_ROOT\Installer\Products\C31EAFF906160DD46AA7AD5C99F418DB\SourceList     Package    : sql_engine_core_inst.msi  Install Source: \x64\setup\sql_engine_core_inst_msi\  LastUsedSource: m;1;G:\x64\setup\sql_engine_core_inst_msi\

The "LastUsedSource" line points to the location that was used to run the Setup program.

In the "LastUsedSource" line, the m; entry signifies media and indicates that the original source is CD/DVD media.

In the following example, the source is a CD or a DVD in drive G. If the installation occurred from a file folder or from a network share, the "LastUsedSource" line begins with an n; entry, followed by a Numeric_Data_Name; entry, and then the actual path:
!!!! sql_engine_core_inst.msi DOES NOT exist on the path in the path G:\x64\setup\sql_engine_core_inst_msi\ !!!! Action needed, re-establish the path to G:\x64\setup\sql_engine_core_inst_msi\ 

The "Action needed" line shows you the full path that must exist in order to update missing files for the original installation media:
Installer Cache File: C:\WINDOWS\Installer\19b4d2.msi 

The "Installer Cache File" line confirms the name of the installer cache file:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! C:\WINDOWS\Installer\19b4d2.msi DOES NOT exist in the Installer cache. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The following section of the output advises you of actions that are required to resolve the missing files:
 Action needed, recreate or re-establish path to the directory:     G:\x64\setup\sql_engine_core_inst_msi\then rerun this script to update installer cache and results     The path on the line above must exist at the root location to resolve     this problem with your msi/msp file not being found or corrupted,     In some cases you may need to manually copy the missing file or manually     replace the problem file overwriting it is exist:       Copy "G:\x64\setup\sql_engine_core_inst_msi\sql_engine_core_inst.msi" C:\WINDOWS\Installer\19b4d2.msi      Replace the existing file if prompted to do so.
Example 2: Missing patches
Missing patches may result in entries that resemble those in Example 1. Most of the time, you will notice entries in the "Patch LastUsedSource" line that reference a patch, and this line resembles the following:
Patch LastUsedSource:   n;1;c:\0ca91e857a4f12dd390f0821a3\HotFixSQL\Files\

This output indicates the following about the patch installation:
  • The original patch was installed by double-clicking the patch's executable file.
  • The installer for the patch used a temp folder, c:\0ca91e857a4f12dd390f0821a3, during installation of the patch.
  • To re-create the path, you must run the same executable and add the following parameter:
    /x:c:\0ca91e857a4f12dd390f0821a3
    Note This command forces the executable to extract the files to the previous missing location, and this re-creates the structure that is required to update the Windows installer cache with any missing files. The actual location will vary, and a single patch such as a service pack may have to be extracted to multiple locations. Each installed product includes a section that contains the following information for "Patches Installed":
    Display name:KB Article URL:  http://support.microsoft.com/?kbid=<value>Patch LastUsedSource: 

    The "KB Article URL" line can help you download any patch media, if this is necessary.

Procedure 2: Manually restore the files

To manually restore the files that are missing from the Windows Installer cache, follow these steps:
  1. Collect the complete details about the missing file from the error message, from the setup log file, or from the registry entries that are maintained by the Windows Installer. For example, in Error Message 1 in the "Symptoms" section, all the information that is required to resolve the issue is present in the error message:
    • PatchName: "Hotfix 1702 for SQL Server 2008 R2 (KB981355) (64-bit)"
    • Original MSP file that is used by the Patch: sql_engine_core_inst.msp
    • Cached MSP file: c:\Windows\Installer\1fdb1aec.msp
  2. If you do not have all the details, see the "More information for Procedure 2" section for the steps to collect these details.
  3. Visit http://support.microsoft.com, and search for the KB article that is associated with this patch. In this example, you must search for KB981355.
  4. Download this patch package to your computer. Make sure that you download the patch package that corresponds to the required platform. In this example, the package is SQLServer2008R2-KB981355-x64.exe.
  5. Extract the contents of the patch package by using the following syntax:
    C:\Temp>SQLServer2008R2-KB981355-x64.exe /x C:\Temp\SQLServer2008R2-KB981355-x64\
  6. Locate the original msp file sql_engine_core_inst.msp file. The file should be in the following folder:
    C:\Temp\SQLServer2008R2-KB981355-x64\x64\setup\sql_engine_core_inst_msi\
  7. Copy this original msp file to the following Windows Installer cache:
    %windir%\installer\
  8. Rename the original msp file, sql_engine_core_inst.msp, to the following name:
    cached msp file 1fdb1aec.msp

You can start the Setup program for the update that resulted in the error and resume the update process. You may encounter this message for a missing Windows Installer cache file for another component or for another update of the same product.

To obtain a list of all the missing Windows Installer cache files that are related to the SQL Server product components, you can download the SQL Server 2008 R2 BPA tool that is mentioned in the "More Information" section.

If the error message references a missing Windows Installer database file (.msi), you do not have to perform steps 2 through 4. Instead, you can go directly to step 5. You have to locate the .msi from the original media that you used to install the product. If this error message was generated for sql_engine_core_inst.msi, then you have to locate this file from the setup media under the following folder structure:
\x64\setup\sql_engine_core_inst_msi\
The other steps are the same.

More information for Procedure 2

How to find the patch package and the product details for a missing .msp file
Different versions of the product generate different error messages for this problem. The error messages that are mentioned in the "Symptoms" section appear for Setup programs for updates starting with Microsoft SQL Server 2008 SP1. For other updates, you receive error messages that may not clearly specify which patch file is missing from the Windows Installer cache and the specific update details. For these error messages, the setup log files will contain information about the missing Windows Installer cache file. A sample setup log resembles the following:
MSI (s) (FC:F8) [13:48:58:649]: Opening existing patch 'C:\WINDOWS\Installer\145258.msp'.MSI (s) (FC:F8) [13:48:58:649]: Couldn't find local patch 'C:\WINDOWS\Installer\145258.msp'. Looking for it at its source.MSI (s) (FC:F8) [13:48:58:649]: Resolving Patch source.MSI (s) (FC:F8) [13:48:58:649]: Note: 1: 2203 2: D:\cda162709d239766830bae5ce12b\HotFixSQL\Files\sqlrun_sql.msp 3: -2147287037 MSI (s) (FC:F8) [13:48:58:649]: SOURCEMGMT: Source is invalid due to missing/inaccessible package.MSI (s) (FC:F8) [13:49:29:961]: Product: Microsoft SQL Server 2005 -- Installation failed.MSI (s) (FC:F8) [13:49:29:992]: MainEngineThread is returning 1635This patch package could not be opened.  Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package.D:\SQL2K5\Servers\Setup\SqlRun_SQL.msi

If you examine this setup log carefully, it already gives you the information about the Original MSP file that was used by the following patch:
sqlrun_sql.msp


To find more details about the missing .msp file in the Windows Installer cache, follow these steps:
  1. Search for the missing .msp file in the following Windows Installer Patches registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\
  2. Find the Patch GUID.
  3. Search for the Patch GUID in the following Windows Installer Products registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\
For the sample setup log, the information about the missing .msp file and its corresponding patch details are present in the following registry entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\A3B085EA74A9A7640A496636F7EF9A44

Value: 0
Name: LocalPackage
Data: C:\WINDOWS\Installer\145258.msp

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\1EB3A031CC585314E87AA527E46EECC2\Patches\A3B085EA74A9A7640A496636F7EF9A44
Value: 6
Name: DisplayName
Data: GDR 2050 for SQL Server Database Services 2005 ENU (KB932555)

Now you have all the information points to start the steps to resolve the missing files in the Windows Installer cache.

Note If you use Microsoft SQL Server 2008 Service Pack 3 (SP3) or a later version, you can also receive a similar error message for the missing .msi files. By using this error message, you can quickly determine which file is missing, what service pack to download, and where you can find the download.

For more information about how to obtain the service pack, click the following article number to view the article in the Microsoft Knowledge Base:
2546951 List of the bugs that are fixed in SQL Server 2008 Service Pack 3

More information
For more information about Windows Installer database (.msi) files, visit the following Microsoft Developer Network (MSDN) website:For more information about Windows Installer patch (.msp file) files, visit the following MSDN website:For more information about the internal details of the Windows Installer cache, see the following MSDN blog:For more information about the patching process, see the following MSDN blog:For more information about how to make sure that you cache the patch file for the correct platform, see the following MSDN blog:For more information about why any product that uses the Windows Installer can encounter this problem, see the following MSDN blog:For more information about the details about different sets of error messages that appear in the setup log files, see the following MSDN blog:

For more information about the products or tools that automatically check for this condition on your instance of SQL Server and on the versions of the SQL Server product, see the following table:
Rule softwareRule titleRule descriptionProduct versions against which the rule is evaluated
SQL Server 2008 R2 Best Practice Analyzer (SQL Server 2008 R2 BPA)Setup - Installer cache is missing for the SQL InstallationThe SQL Server 2008 R2 Best Practice Analyzer (SQL Server 2008 R2 BPA) provides a rule to detect Missing Installer cache file for SQL Server components. The SQL Server 2008 R2 BPA supports both SQL Server 2008 and SQL Server 2008 R2. If you run the BPA tool and encounter an Error with the title of Setup - Installer cache is missing for the SQL Installation, and then the cache files are missing from the cache folder.SQL Server 2008
SQL Server 2008 R2
SQL Server 2012 Best Practice Analyzer (SQL Server 2012 BPA)Setup - Installer cache is missing for the SQL InstallationThe SQL Server 2012 Best Practice Analyzer (SQL Server 2012 BPA) provides a rule to detect Missing Installer cache file for SQL Server components. If you run the BPA tool and encounter an Error with the title of Setup - Installer cache is missing for the SQL Installation, and then the cache files are missing from the cache folder.SQL Server 2012



FindSQLInstalls.vbs script

' Copyright © Microsoft Corporation.  All Rights Reserved.' This code released under the terms of the ' Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)  On Error Resume Next Dim arrSubKeys, arrSubKeys2Dim objFSO, objShell, objFile, objReg, objConn, objExecDim strComputer, strKeyPath, strNewSourceDim strWorkstationName, strDBPath, strSubKey, strSubKey2(), strKeyPath02,  strRetValue00Dim strRetValue01, strRetValue02, strRetValNew02, strRetValNew03, strRetValNew04, strRetValNew05, strRetValNew06, strRetValNew07, strRetValNew08, strRetValNew09, strRetValue10, strRetValNew10, strRetValNew11, strRetValNew12, strRetValNew13, strRetValNew14, strRetValNew14a, strRetValNew14b, strRetValNew15, strRetValNew15a, strRetValNew15b, strRetValNew16, strRetValNew17, strRetValNew18 Const HKCR = &H80000000 'HKEY_CLASSES_ROOTConst HKLM = &H80000002 'HKEY_LOCAL_MACHINEConst ForReading = 1, ForWriting = 2, ForAppEnding = 8 ' Checking for Elevated permissionsDim oShell, oExecszStdOutszStdOut = ""Set oShell = CreateObject("WScript.Shell")Set oExec = oShell.Exec("whoami /groups") Do While (oExec.Status = cnWshRunning)    WScript.Sleep 100       if not oExec.StdOut.AtEndOfStream Then                szStdOut = szStdOut & oExec.StdOut.ReadAll       end IfLoop select case oExec.ExitCode   case 0       if not oExec.StdOut.AtEndOfStream Then           szStdOut = szStdOut & oExec.StdOut.ReadAll       End If       If instr(szStdOut,"Mandatory Label\High Mandatory Level") Then                wscript.echo "Elevated, executing script and gathering requested data"       Else           if instr(szStdOut,"Mandatory Label\Medium Mandatory Level")  Then          Wscript.echo "Not Elevated must run from Administrative commmand line."       Else          Wscript.echo "Gathering requested data..."           end If      End If   case Else       if not oExec.StdErr.AtEndOfStream Then          wscript.echo oExec.StdErr.ReadAll       end If       end select '' Leaving strNewSource will result in no search path updating.' Currently DO NOT EDIT these.strNewSource = ""strNewRTMSource = "" ' Define string valuesstrComputer = "."strSQLName = "SQL"strDotNetName = ".NET"strVStudioName = "Visual Studio"strXML = "XML"strOWC = "Microsoft Office 2003 Web Components"strKeyPath = "Installer\Products"strKeyPath2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"strNValue00 = "ProductName"strNValue01 = "PackageName"strNValue02 = "LastUsedSource"strNValue03 = "InstallSource"strNValue04 = "LocalPackage"strNValue05 = "DisplayVersion"strNValue06 = "InstallDate"strNValue07 = "UninstallString"strNValue08 = "PackageCode"strNValue09 = "MediaPackage"strNValue10 = "InstallSource"strNValue11 = "AllPatches"strNValue12 = "NoRepair"strNValue13 = "MoreInfoURL"strNValue14 = "PackageName"strNValue15 = "LastUsedSource"strNValue16 = "Uninstallable"strNValue17 = "DisplayName"strNValue18 = "Installed" If WScript.arguments.count <> 1 Then   WScript.echo "Usage: cscript " & WScript.scriptname & " outputfilename.txt"   WScript.quitEnd If '--Setup the output fileSet fso = CreateObject("Scripting.FileSystemObject")Set txtFile = fso.OpenTextFile(WScript.arguments(0), ForWriting, True)If err.number <> 0 Then    WScript.echo "Error 0x" & myHex(err.number,8) & ": " & err.source & " - " & err.description    WScript.quitEnd If txtFile.writeline "Products installed on the local system"txtFile.writeline " "txtFile.writeline " "  Set objFSO = CreateObject("Scripting.FileSystemObject")Set objShell = WScript.CreateObject("WScript.Shell") '--Set up the registry provider.Set objReg = GetObject("winmgmts:\\" & strComputer & _"\root\default:StdRegProv") Set wiInstaller = CreateObject("WindowsInstaller.Installer") '--Enumerate the "installer\products" key on HKCRobjReg.EnumKey HKCR, strKeyPath, arrSubKeys For Each strSubKey In arrSubKeys ' Define the various registry pathsstrProduct01 = "Installer\Products\" & strSubKeystrKeyPath02 = "Installer\Products\" & strSubKey & "\SourceList"strKeyPath03 = "Installer\Products\" & strSubKey & "\SourceList\Media"strInstallSource = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" & strSubKey & "\InstallProperties\"strInstallSource2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" & strSubKey & "\patches\"strInstallSource3 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches"strInstallSource5 = "SOFTWARE\Classes\Installer\Patches\"strInstallSource6 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"strInstallSource7 = "SOFTWARE\Microsoft\Microsoft SQL Server\"strInstallSource8 = "SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\" ' Pull the intial valuesobjReg.GetStringValue HKCR, strProduct01, strNValue00, strRetValue00objReg.GetStringValue HKCR, strKeyPath02, strNValue01, strRetValue01objReg.GetStringValue HKCR, strKeyPath02, strNValue02, strRetValue02strRetValNew02 = Mid(strRetValue02, 5)objReg.GetStringValue HKCR, strKeyPath03, strNValue09, strRetValue09strRetValue10 = strNewRTMSource & strRetValue09objReg.GetStringValue HKLM, strInstallSource, strNValue03, strRetValNew03objReg.GetStringValue HKLM, strInstallSource, strNValue04, strRetValNew04objReg.GetStringValue HKLM, strInstallSource, strNValue05, strRetValNew05objReg.GetStringValue HKLM, strInstallSource, strNValue06, strRetValNew06objReg.GetStringValue HKLM, strInstallSource, strNValue07, strRetValNew07objReg.GetStringValue HKLM, strInstallSource, strNValue10, strRetValNew10objReg.GetStringValue HKLM, strInstallSource, strNValue12, strRetValNew12objReg.GetStringValue HKLM, strInstallSource, strNValue13, strRetValNew13objReg.GetStringValue HKLM, strInstallSource2, strNValue11, strRetValNew11 ' Pull the Product Code from the Uninstall StringstrProdCode = strRetValNew07  ProdCodeLen = Len(strProdCode)  ProdCodeLen = ProdCodeLen - 14strRetValNew08 = Right(strProdCode, ProdCodeLen) ' Pull out path from LastUsedSourcestrGetRealPath = strRetValue02  GetRealPath = Len(strRetValue02)strRealPath = Mid(strRetValue02, 5, GetRealPath) ' Identifie the string in the ProductNameIf instr(1, strRetValue00, strSQLName, 1) Then' Start the log output    txtFile.writeline "================================================================================"    txtFile.writeline "PRODUCT NAME   : " & strRetValue00    txtFile.writeline "================================================================================"    txtFile.writeline "  Product Code: " & strRetValNew08    txtFile.writeline "  Version     : " & strRetValNew05    txtFile.writeline "  Most Current Install Date: " & strRetValNew06    txtFile.writeline "  Target Install Location: "  & strRetValNew13    txtFile.writeline "  Registry Path: "    txtFile.writeline "   HKEY_CLASSES_ROOT\" & strKeyPath02    txtFile.writeline "     Package    : " & strRetValue01    txtFile.writeline "  Install Source: " & strRetValue10    txtFile.writeline "  LastUsedSource: " & strRetValue02'   txtFile.writeline "Does this file on this path exist? " & strRetValNew02 & "\" & strRetValue01    If fso.fileexists(strRetValNew02 & "\" & strRetValue01) Then    txtFile.writeline  " "        txtFile.writeline "    " & strRetValue01 & " exists on the LastUsedSource path, no actions needed."    Else        txtFile.writeline " "        txtFile.writeline " !!!! " & strRetValue01 & " DOES NOT exist on the path in the path " & strRealPath & " !!!!"        txtFile.writeline " "        txtFile.writeline " Action needed, re-establish the path to " & strRealPath' Placeholder for altering the LastUsedSource by adding source location and Forcing search of list'        If strNewSource <> "" Then'        txtFile.writeline "      New Install Source Path Added: " & strNewSource'        wiInstaller.AddSource strRetValNew08, "", strNewSource'        Else'        If strNewRTMSource <> "" Then'        wiInstaller.AddSource strRetValNew08, "", strNewRTMSource'        txtFile.writeline "      Forcing SourceList Resolution For: " & strRetValNew08'        wiInstaller.ForceSourceListResolution strRetValNew08, ""'        End If'        End If    End If        txtFile.writeline " "        txtFile.writeline "Installer Cache File: " & strRetValNew04    If fso.fileexists(strRetValNew04) Then        txtFile.writeline " "        txtFile.writeline "    Package exists in the Installer cache, no actions needed."        txtFile.writeline "    Any missing packages will update automatically if needed assuming that"        txtFile.writeline "    the LastUsedSource exists."        txtFile.writeline " "        txtFile.writeline "    Should you get errors about " & strRetValNew04 & " or " & strRealPath & strRetValue01 & " then you"        txtFile.writeline "    may need to manually copy the file, if file exists replace the problem file, "         txtFile.writeline "    Copy and paste the following command line into an administrative command prompt:"        txtFile.writeline " "        txtFile.writeline "     Copy " & chr(34) & strRealPath  & strRetValue01 & chr(34) & " " &strRetValNew04        txtFile.writeline " "    ElseIf fso.fileexists(strRetValNew02 & "\" & strRetValue01) Then              fso.CopyFile strRetValNew02 & "\" & strRetValue01, strRetValNew04        If fso.fileexists(strRetValNew04) Then          txtFile.writeline " "          txtFile.writeline "     Missing cache file replaced by copying " & strRealPath  & strRetValue01 & " to " & strRetValNew04          txtFile.writeline "     Previously missing package " & strRetValNew04 &  " now exists in the Installer cache."          txtFile.writeline " "        End If    Else        txtFile.writeline " "        txtFile.writeline " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"        txtFile.writeline " !!!! " & strRetValNew04 & " DOES NOT exist in the Installer cache. !!!!"        txtFile.writeline " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"        txtFile.writeline " "        txtFile.writeline "     Action needed, recreate or re-establish path to the directory:"        txtFile.writeline "       " & strRealPath & "then rerun this script to update installer cache and results"        txtFile.writeline "     The path on the line above must exist at the root location to resolve"        txtFile.writeline "     this problem with your msi/msp file not being found or corrupted,"        txtFile.writeline "     In some cases you may need to manually copy the missing file or manually"        txtFile.writeline "     replace the problem file overwriting it is exist: "         txtFile.writeline " "        txtFile.writeline "     Copy " & chr(34) & strRealPath  & strRetValue01 & chr(34) & " " &strRetValNew04        txtFile.writeline " "        txtFile.writeline "     Replace the existing file if prompted to do so."        txtFile.writeline " "    End If    txtFile.writeline " "    txtFile.writeline strRetValue00 & " Patches Installed "    txtFile.writeline "--------------------------------------------------------------------------------"     err.clear    objReg.EnumKey HKLM, strInstallSource2, arrSubKeys2    uUpperBounds = UBound(arrSubKeys2,1)     If err.number = 0  Then        For Each strSubKey2 in arrSubKeys2    '    WScript.echo "value = " & strSubKey2 strKeyPath04 = "Installer\Patches\" & strSubKey2 & "\SourceList"      objReg.GetDWORDValue HKLM, strInstallSource2 & "\" & strSubKey2 & "\", strNValue16, strRetValue16     objReg.GetStringValue HKCR, strKeyPath04, strNValue15, strRetValue15a     objReg.GetStringValue HKCR, strKeyPath04, strNValue14, strRetValue14a     objReg.GetStringValue HKCR, strKeyPath02, strNValue15, strRetValue15b     objReg.GetStringValue HKCR, strKeyPath02, strNValue14, strRetValue14b     objReg.GetStringValue HKLM, strInstallSource2 & "\" & strSubKey2 & "\", strNValue17, strRetValue17     objReg.GetStringValue HKLM, strInstallSource2 & "\" & strSubKey2 & "\", strNValue18, strRetValue18     objReg.GetStringValue HKLM, strInstallSource2 & "\" & strSubKey2 & "\", strNValue13, strRetValue13a     objReg.GetStringValue HKLM, strInstallSource3 & "\" & strSubKey2 & "\", strNValue04, strRetValue04a ' Pull the URL from the MoreInfoURL StringstrMoreInfoURL = strRetValue13a  MoreInfoURLLen = Len(strMoreInfoURL)strRetValue13b = Right(strMoreInfoURL, 42) ' Pull the URL from the LastUsedPath StringstrLastUsedPath = strRetValue15a  LastUsedPathLen = Len(strLastUsedPath)  'LastUsedPathLen = LastUsedPathLen - 15strRetValue15c = Mid(strLastUsedPath, 5)       txtFile.writeline " Display Name:    " & strRetValue17       txtFile.writeline " KB Article URL:  " & strRetValue13b      txtFile.writeline " Install Date:    " & strRetValue18               txtFile.writeline "   Uninstallable:   " & strRetValue16       txtfile.writeline " Patch Details: "      txtFile.writeline "   HKEY_CLASSES_ROOT\Installer\Patches\" & strSubKey2              txtFile.writeline "   PackageName:   " & strRetValue14a' Determine if someone has modified the Uninstallable state from 0 to 1 allowing possible unexpected uninstalls              txtFile.writeline "    Patch LastUsedSource: " & strRetValue15a               txtFile.writeline "   Installer Cache File Path:     " & strRetValue04a         txtFile.writeline "     Per " & strInstallSource3 & "\" & strSubKey2 & "\" & strNValue04              mspFileName = (strRetValue15c  & strRetValue14a)      If strRetValue14a <> "" Then      If fso.fileexists(strRetValue04a) Then        txtFile.writeline " "        txtFile.writeline "    Package exists in the Installer cache, no actions needed."        txtFile.writeline "    Package will update automatically if needed assuming that"        txtFile.writeline "    the LastUsedSource exists."        txtFile.writeline " "        txtFile.writeline "    Should you get errors about " & strRetValue04a & " or " & strRetValue15c  & strRetValue14a & " then you"        txtFile.writeline "    may need to manually copy missing files, if file exists replace the problem file, "         txtFile.writeline "    Copy and paste the following command line into an administrative command prompt."        txtFile.writeline " "        txtFile.writeline "     Copy " & chr(34) & strRetValue15c  & strRetValue14a & chr(34) & " " & strRetValue04a        txtFile.writeline " "      ElseIf fso.fileexists(mspFileName) Then              fso.CopyFile mspFileName, strRetValue04a          If fso.fileexists(strRetValue04a) Then          txtFile.writeline " "          txtFile.writeline " Missing cache file replaced by copying " & strRetValue15c  & strRetValue14a & " to " & strRetValue04a          txtFile.writeline " Previously missing package " & strRetValNew04 &  " now exists in the Installer cache."          txtFile.writeline " "          End If'        End If      Else        txtFile.writeline " "        txtFile.writeline "!!!! " & strRetValue04a & " package DOES NOT exist in the Installer cache. !!!!"        txtFile.writeline " "        txtFile.writeline "     Action needed, recreate or re-establish path to the directory:"        txtFile.writeline "       " & strRetValue15c & " then rerun this script to update installer cache and results"        txtFile.writeline "     The path on the line above must exist at the root location to resolve"        txtFile.writeline "     this problem with your msi/msp file not being found or corrupted,"        txtFile.writeline "     In some cases you may need to manually copy missing files or manually"        txtFile.writeline "     replace the problem file, "         txtFile.writeline " "        txtFile.writeline "     Copy " & chr(34) & strRetValue15c  & strRetValue14a & chr(34) & " " & strRetValue04a        txtFile.writeline " "        txtFile.writeline "     Replace the existing file if prompted to do so."        txtFile.writeline " "        txtFile.writeline "     Use the following URL to assist with downloading the patch:"        txtFile.writeline "      " & strRetValue13b        txtFile.writeline " "        txtFile.writeline " "      End If       Else        txtFile.writeline " "     End If        next     Else        txtfile.writeline " "        txtfile.Writeline "  No Patches Found"        txtfile.writeline " "    End If     End If  NexttxtFile.CloseSet txtFile = NothingSet fso = Nothing
Properties

Article ID: 969052 - Last Review: 03/08/2016 18:42:00 - Revision: 20.0

, , , , , , , , , , , , , , , , , , Microsoft SQL Server 2005 Developer Edition, Microsoft SQL Server 2005 Enterprise Edition, Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems, Microsoft SQL Server 2005 Enterprise X64 Edition, Microsoft SQL Server 2005 Evaluation Edition, Microsoft SQL Server 2005 Express Edition, , Microsoft SQL Server 2005 Standard Edition, Microsoft SQL Server 2005 Standard X64 Edition, Microsoft SQL Server 2005 Workgroup Edition, Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems, , , , ,

  • kbtshoot kbexpertiseinter kbprb kbsurveynew KB969052
Feedback
ePV = 1; var varClickTracking = 1; var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write(" language);" class="ng-binding" id="language-tr-tr">Türkiye - Türkçe
台灣 - 繁體中文
Ecuador - Español
New Zealand - English
United Kingdom - English
日本 - 日本語
Eesti - Eesti
Norge - Bokmål
United States (English)
香港特別行政區 - 繁體中文
El Salvador - Español
Panamá - Español
Uruguay - Español
대한민국 - 한국어
España - Español
Paraguay - Español
Venezuela - Español
://c1.microsoft.com/c.gif?DI=4050&did=1&t=">I=4050&did=1&t="> var Route = "76500"; var Ctrl = ""; document.write(" ')[0].appendChild(m);" onload="var m=document.createElement('meta');m.name='ms.dqp0';m.content='false';document.getElementsByTagName('head')[0].appendChild(m);" src="http://c1.microsoft.com/c.gif?"> >>