cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Christopher_Jay
Level 3

Uninstall SQL Server (or other setups) that were installed before feature selection

Hello,

We needed to install SQL Server before feature selection because InstallShield wasn't letting us run the install while our install was running.

Now when we uninstall our program, SQL Server does not get uninstalled like we need it to.

How/where can I write some command lines to uninstall merge modules and prerequisites that were installed before feature selection?

Thanks.
Labels (1)
0 Kudos
(3) Replies
DLee65
Level 13

I suspect that you only have to uninstall a particular instance of SQL Server, is this correct? It is rare that someone needs to uninstall SQL Server completely and what if there are multiple instances installed on a client's computer and you uninstall the instance from another application?

1. Be sure you are only uninstalling your instance of SQL Server.
2. To do this you can attempt to run the SQL Server setup.exe in the bootstrapper bin location. MSDN has information on uninstalling instances for each particular version of SQL Server. I think the syntax is slightly different.
3. Now the caveat is that I found that this does not always work 100% and that I had to code something that would do a lookup in the registry for the instance and cleanup the registry of the instance information. I had to do this for our SQL Server 2005 Express instance. Unfortunately it is not a straightforward 'just kill this key' type of thing.
3a. You have to look up named instances for the correct key name, find the key name, then determine the installed version of instance (if appropriate in your case, in our case some customers had upgraded to a full version of SQL Server so we did not want to kill the key), and then delete the key if appropriate. I forget off the top of my head if there were any extra keys to delete in the registry. In any case we first tried running the EXE and if that returns and error then we tried the manual cleanup.

Hopefully I did not misunderstand your goal. It sounded very similar to what I had to accomplish when upgrading our clients from an instance of SQL Server 2005 Express to SQL Server 2012 Express. Remember you are not uninstalling SQL Server 2005, you are just uninstalling your instance. Other applications may depend on 2005 Express, unless of course you are working in a known environment and you know the condition of all the systems on which the final product will install. 🙂
0 Kudos
Christopher_Jay
Level 3

Thanks a lot for your response. For the most part our users will not have SQL Server installed on their servers for any other reason, but I agree with your assessment of possibly uninstalling just the instance. Luckily, our instance is hardcoded into our setup.

I was trying to use the bootstrapper thingie but the command line options that were valid on earlier versions of SQL Express were not working with SQL Express 2012 and I couldn't find the correct ones to get it to work (even /help or /? didn't work).

If I ever do find the correct command line, I guess I have to create a Custom Action and have it run on uninstall, correct? I found that I should use REMOVE="ALL" as the condition to get it to run on uninstall.

Thanks again.


DLee65 wrote:
I suspect that you only have to uninstall a particular instance of SQL Server, is this correct? It is rare that someone needs to uninstall SQL Server completely and what if there are multiple instances installed on a client's computer and you uninstall the instance from another application?

1. Be sure you are only uninstalling your instance of SQL Server.
2. To do this you can attempt to run the SQL Server setup.exe in the bootstrapper bin location. MSDN has information on uninstalling instances for each particular version of SQL Server. I think the syntax is slightly different.
3. Now the caveat is that I found that this does not always work 100% and that I had to code something that would do a lookup in the registry for the instance and cleanup the registry of the instance information. I had to do this for our SQL Server 2005 Express instance. Unfortunately it is not a straightforward 'just kill this key' type of thing.
3a. You have to look up named instances for the correct key name, find the key name, then determine the installed version of instance (if appropriate in your case, in our case some customers had upgraded to a full version of SQL Server so we did not want to kill the key), and then delete the key if appropriate. I forget off the top of my head if there were any extra keys to delete in the registry. In any case we first tried running the EXE and if that returns and error then we tried the manual cleanup.

Hopefully I did not misunderstand your goal. It sounded very similar to what I had to accomplish when upgrading our clients from an instance of SQL Server 2005 Express to SQL Server 2012 Express. Remember you are not uninstalling SQL Server 2005, you are just uninstalling your instance. Other applications may depend on 2005 Express, unless of course you are working in a known environment and you know the condition of all the systems on which the final product will install. 🙂
0 Kudos
DLee65
Level 13

Christopher Jay wrote:
Thanks a lot for your response. For the most part our users will not have SQL Server installed on their servers for any other reason, but I agree with your assessment of possibly uninstalling just the instance. Luckily, our instance is hardcoded into our setup.

I was trying to use the bootstrapper thingie but the command line options that were valid on earlier versions of SQL Express were not working with SQL Express 2012 and I couldn't find the correct ones to get it to work (even /help or /? didn't work).

If I ever do find the correct command line, I guess I have to create a Custom Action and have it run on uninstall, correct? I found that I should use REMOVE="ALL" as the condition to get it to run on uninstall.

Thanks again.


Christopher,

I believe that when running the setup we had to use REMOVE=[FeatureList] where [FeatureList] equals the value found in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\[InstanceNameValue]\Setup|FeatureList

You also need to specify /INSTANCENAME=[YOURINSTANCEVALUE]

I have been trying to find an actual command line that we were using, however, I think we just reverted to using the manual method. The problem we ran into is that some of our users had run windows update and sql server is now 'newer' and the setup.exe would no longer uninstall the instance or something like that. Our installer was distributing SQL Server 2005 sp3. Somehow some machines had sp4 on it and when it does the uninstall will fail. So we just reverted to cleaning the registry manually. It was about a year ago so my memory is a little hazy now and I am not finding the code for the command line readily. I can see some code pieces in vb6, which is what we were using at the time, for Wise Installer. I have to redo all of this for use with InstallShield here in a few weeks. 😄
0 Kudos