Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

How to manually uninstall SQL Express if uninstalling from Add/Remove Programs fails

How to manually uninstall SQL Express if uninstalling from Add/Remove Programs fails

Rate This
  • Comments 72

I have heard from a few customers (inside and outside of Microsoft) who have had problems uninstalling previous beta versions of SQL Express via Add/Remove Programs or via the cleanup tools we have released (located here and here).  These customers have seen unexpected errors in the datastore related to the actions named RestoreSetupParams and/or Write_CommitFlag.  The exact error message states that setup is unable to write property into the cache: IsClustered and unable to write property into the cache: flagCommit.

I haven't narrowed down the exact sequence, but these uninstall errors are caused by uninstalling beta versions of SQL 2005 and/or VS 2005 in specific orders.  The officially recommended uninstall order for these products can be found at this location.  However, this order is not enforced via the Add/Remove Programs control panel and it is pretty easy to overlook the readme and uninstall in alphabetical order or some other random order and get into this state.

If you encounter either or both of the above error dialogs, you can use the following steps to resolve the errors:

  1. Download and run msiinv.exe using the instructions in this previous blog post
  2. Look at the output from msiinv.exe in a text editor such as notepad and locate each of the products that are installed that have SQL 2005 in the name
  3. Click on the Start menu, choose Run and type cmd
  4. For each of the SQL 2005 product codes found in the msiinv.exe output, run msiexec /x {Product Code} from the cmd prompt - this command will likely generate the same errors shown above but it is good to run it just in case
  5. Download the smartmsizap tool
  6. For each of the SQL 2005 product codes found in the msiinv.exe output, run smartmsizap.exe /p {Product Code} from the cmd prompt

After running smartmsizap to cleanup each of the SQL 2005 products left behind on your machine, you should be able to successfully install later builds of SQL Express and/or VS 2005.

<update date="11/26/2005"> Added text descriptions of the error messages to make it more likely that this blog post will be found from internet search engines because I have heard from a lot of customers who have run into this error but not found this blog post. Also modified the uninstall instructions to use the smartmsizap tool that I had not yet written at the time that I originally wrote this blog post. </update>

<update date="4/14/2009"> Fixed broken link to the smartmsizap tool and removed broken image links. </update>

<update date="8/27/2010"> Fixed broken link to the VS 2005 uninstall instructions and the TTool.zip tool. </update>


  • this worked fine for removing SQL server express edition from the MSI database. It's no longer seen as an installed application but the SQL services are still installed on my machine and the source files still exist. So now what should be done?
  • Hi Lance,

    You can do the following to remove the SQL services from your system:

    1. Click on the Start menu, choose Run and type cmd

    2. Run the command sc delete <service_name> for each SQL 2005 service still on your system

    3. Remove orphaned SQL instances by using the steps located at http://blogs.msdn.com/astebner/archive/2005/12/08/501885.aspx

    4. Remove orphaned SQL 2005 files if desired (but I haven't seen this being necesary because installing the final release of SQL 2005 will replace the beta files)

    5. Try to install the final release of SQL 2005

    Hope this helps!
  • thanks a lot !
  • I followed the msiinv.exe advise and after I installed the SQL Express, I keep getting the message that SQLExpress installation has failed. A closer look at the files in the ..\80 and ..\90 folder show most files are not present. I'm at my wits end as to how to solve this problem. Dont know how to find which entries in the registry are affecting me or for that matter what is the problem. Can anyone help?
  • Hi Satya - SQL Express setup creates log files at %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\Log\Files that should help figure out why the installation failed.  You might be running into the issue described at http://blogs.msdn.com/astebner/archive/2005/12/08/501885.aspx but it is hard to say for sure without looking at the log files.  If possible, please contact me using http://blogs.msdn.com/astebner/contact.aspx and send me the log files from that folder so I can try to take a quick look and see if I can figure out why SQL setup is failing for you in this scenario.
  • I have downloaded your tool "Visual Studio 2005" and after processing I get the message:
    "The following task did not complete successfully:
    Uninstall Visual Studio components "
    What else can I do to remove the beta version of sql express?

  • Hi Jorge - You can also use the steps listed at http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx to locate and manually remove any remaining beta components on your system.
  • http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx is dead, Server Error in '/' Application.  Nice.
  • Hi Derek - It appears that there was a temporary hiccup on the blog server.  That link is working fine for me now.  Can you please try again and see if it works for you?
  • i have tried this but i still get the error message you see above when i try to install via the microsoft unistall. and when i try to put the new sql on my computer i still get the message detecting a previous install.

    any thoughts?
  • Hi Jay - Could you please contact me via http://blogs.msdn.com/astebner/contact.aspx and provide an updated list of installed programs that you gather with the msiinv.exe tool (produced in step 1 of the instructions on this blog post).
  • when I run msiinv.exe I don't seem to get an output file anywhere.  I'm running it from the desktop b/c when I run it from cmd it tells me it's not a valid command.

    thanks for the help!
  • Hi Spencer - You have to run msiinv.exe from a cmd prompt in order to be able to redirect the output to a text file.  You should be able to do the following:

    1. Click on the Start menu, choose Run and type cmd

    2. In the cmd window, change directories to the path where you saved msiinv.exe to

    3.  Run msiinv.exe > c:\output.txt or some other file name

    The greater than (>) sign causes output to be sent to a file instead of to the cmd console window.
  • This guide helped me greatly!!!!!!

    Was seconds from formatting (or throwing the computer out the window)
  • Hi,

    When I run the following command:

    Run msiinv.exe > c:\output.txt

    I then look for but find no file named output.txt in the c: drive.

    So I created a blank text file with the same name above at the expected location, run msiinv.exe again and then open the file to find it is still empty.

    What am I missing here?
Page 2 of 5 (72 items) 12345
Leave a Comment
  • Please add 8 and 2 and type the answer here:
  • Post