Patching Issue – Fixing of Missing Windows Installer Cache Files(.MSI & .MSP) which occurs during SQL Server Update

When you are installing a Microsoft SQL Server service pack or a cumulative update, sometimes we will encounter the error messages with Windows Installer Cache problems. The Windows Installer Cache are located at c:\windows\installer folder which stores important files for applications installed using the Windows Installer technology and should not be deleted. The problem occurs when we are performing these actions such as uninstall, repair, or update SQL Server

Note : If the Cache installer is compromised then you will not see any immediate problems

.The issue occurs when the cache files are deleted from the location c:\windows\installer.

The problem occurs when the Windows Installer database file (.msi) and the Windows Installer patch file (.msp) is missing from the Windows Installer cache folder. The Windows Installer cache is located in the following folder:

        C:\Windows\installer

After doing SQL Patching changes continuously for so many servers without any Issue yesterday when Implementing SQL Patching on one of the Critical Server finally the day has arrived and faced Missing of MSI & MSP error issue

When I run SQL Server 2008R2 ServicePack 3 Initial Setup wizard itself not getting opened and throwing below error :

As per the Error I have fixed the Issue of Missing File by Copying the file .MSI which was mentioned in above to INSTALLER Folder  from SQL Media and started running Service Pack 3 again , still having issue and got other error as below :

I have fixed this error as well in the same way which I did as above and Initiated Service Pack 3 again now this time the Initial setup wizard was opened and the setup was started

After clicking the Update button in few minutes an error was popped up saying another MSI file was missing as it is not the best way to fix these MSI and MSP errors  also not sure how many files are Missing.

So, I have Cancelled the Setup and checked for Missing Files using FindSQLInstalls.vbs script
which helped me to find missing of MSI & MSP files before we start the ServicePack 3 Setup.

Script was found in MICROSOFT site  https://support.microsoft.com/en-gb/help/969052/how-to-restore-the-missing-windows-installer-cache-files-and-resolve-p#%2Fen-gb%2Fkb%2F969052

Copied the script to Server ‘ XXX ‘and saved at Location E:\MSI\FindSQLInstalls.vbs ..Ran the script from Command Prompt by redirecting the directory from Drive C to E:\MSI

                                          FindSQLInstalls.vbs E:\MSI\output.txt

Note : This script needs Elevated Administrative Privileges , Open the Command Prompt with Run As Administrator

The output file contains all the Missing Files of MSI & MSP which needs to fix before staring the SP setup

Open the output.txt file and search with key word  ” DOES NOT   “

Below Screenshot for finding out of MSP file

Below Screenshot for finding out MSI File

Copied the Location( COPY “Path”) from the txt file and kept in a side which is Highlighted in above screen shots

Now opened the Media file and copied the MSI file to C:\Windows\Installer Folder and Renamed the MSI File to Cached name which is shown in Error

Again searched with key word  ” DOES NOT ” till the end of the txt file and found total 25 Missing Files

Fixed all Missing files and ran the Script again in Command Prompt  FindSQLInstalls.vbs E:\MSI\output.txt to check that no files are missing before starting the SP installation.

Opened the Output file and searched for key word ” DOES NOT   ”  this time I didn’t find any Missing File which Needs to take Action

So started running SP3 but after Fixing the MSI and MSP files it asked for Server RESTART

I requested windows team to reboot,once server is came UP Initiated SP3 , this time patch was completed successfully.

After SP completion it was asked for RESTART of Server again and once the Server is Up I  started Installing Security Update and this time again some new Issue I faced which is shown below :

The location which is showing in above error was not exist on Drive H  …So, I have clicked browse button and given the correct path of the File sqlncli.msi and clicked OK

But popped up with error not a valid one

So, Clicked ok and Cancel but the setup was Running and Finally the Security Update was Successfully Applied

The Security Update KB article is Reflecting KB4057113 and all looks Good .

NOTE :

1. The SQL Media\Service Pack \ Security Update \ Cumulative Update any patch or ISO file we need to EXTRACT Manually first to a Specific location or folder and then run the installation by clicking on “SETUP.exe” file which is Best Practice for Installation

2 .If we run the Package directly without Manual extraction the Software will extract  Automatically to Some UN-known Location and will start the Setup Once that the server is REBOOTED sometimes that UN-known location will not be exist on the server and next time when we run any New SP\CU\SU it will check for Previously Extracted location but unfortunately that location is not available on Server it will throw an error and the installation will Failed.