# Missing .msi files gives error while repairing SQL Server 2008R2

I've got a SQL Server 2008R2 SP1 database installed and I'm trying to run a repair on it using a 2008R2 install binaries.

In the middle of the repair loading, the window suddenly shuts down and gives me this error message, anyone knows what to do with that ? My searching skills have left me alone as of now.

• Why are you repairing SQL Server? Why don't we try to solve that problem? – Aaron Bertrand Jun 23 '16 at 18:05

The script provided by Microsoft in the Knowledge Base article:

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

...found the missing files and allowed me to advance a bit:

1. Save the script to your desktop

2. Run it using CMD

cscript scriptname.vbs scriptoutput.txt

3. Find all the copy commands in the text file and use them to populate your Windows installer folder. Those missing files are causing your issue.

EDIT

The step 3 needs a little more explaining: The text file produced from the VBS script contains various recommendations and mostly suggests to copy the files from certain locations (more on that later) to the %windir%\installer path where they should be in order for any upgrade/patch/repair process to work.

In my case, I had sqlserver 2008R2 SP1 so the output textfile basically told me "I need certain vanilla files and certain SP1 files"

Here is the script asking for vanilla files, which can be found in a stock sqlserver2008r2 installer DVD

Copy "C:\Source\Sources SQL 2008\SQL 2008 R2\SQL2008R2_source\x64\setup\sql_engine_core_inst_msi\sql_engine_core_inst.msi" C:\Windows\Installer\2d620c2b.msi


And here is the script asking for SP1 files :

Copy "g:\10bb0cd00ccb163360\x64\setup\sql_engine_core_inst_msi\sql_engine_core_inst.msp" C:\Windows\Installer\2d8607e0.msp


SQLSERVER will remember where it found those files the first time it had to use them, but this location might not exist anymore if, as in my case, someone did tons of cleaning on the server and deleted all of you precious files.

You will need to modify the first part of the path so it matches the location of your extracted DVD and of your extracted SP1 patch. To extract the SP1 patch, you can run the following command in a CMD prompt

c:\path\to\file\SQLServer2008R2SP1-KB2528583-x64-ENU.exe /x


Notice, the /x at the end, this command will open a small window asking where you want the content to be extracted.

You can try my PowerShell script “Restore-InstallerFiles.ps1” which is able to scan for the missing files and to restore them from different sources such as local folder, shared folder or another machine which can be accessed from the target machine.