Cloud & SQLSailor

Cloud, Databases & Beyond!

Sit back,Relax and Enjoy ! – Unattended uninstall of SQL Server instances


Today I had to remove multiple named instances of SQL2012 RC 0 editions. Suddenly an idea came to my mind. Is there a way were we can remove multiple named instances all at once.

If you look the below screen, you can see that there are multiple instances available in the same server, and I need to remove the first three instances all at once.

If we use add/remove option, then the above screen will only allow us to choose 1 Instance at a time for removal. This was indeed time consuming, and I was thinking of better ways to remove instances all at once.

Is it possible to remove all the required instances at once? Apparently the answer is NO, you cannot remove all the required instances (Selected ones) using GUI.

I was then looking for ways to speed up the whole process of uninstall and then the idea of cmdline uninstall came to my mind. Using command line we can also make the uninstall unattended.This simply means that SQL Server instance can be uninstalled in quite mode without any user interaction.

The below command line statement was quickly prepared, and this helped me with uninstall with more ease, and I don’t have to involve much rather than running the command for the first time.

You will need to run this command from the setup boot strap folder of the respective version of SQL Server

Setup.exe /Action=Uninstall /FEATURES=SQL /INSTANCENAME=SERVER2012B /Q

/Features  = SQL will remove Engine,Replication,Full Text and Data Quality and this option should be used with lot of care.

/Q  = Will do the silent mode work and it’s called as Quite mode.

Conclusion


I found cmdline option as much easy and flexible solution and won’t mind to leverage them for non – production environments.

These cmdline options can also be used for Installation purpose, and I will write about the same during coming days.

Thanks for reading.

14 responses to “Sit back,Relax and Enjoy ! – Unattended uninstall of SQL Server instances”

  1. GS Sohal Avatar

    Hi Anup ,Thanks for sharing … is the SQL setup requirement a must for doing the cmdlet uninstall,any way to do it without setup binaries …

    1. Anup Avatar

      Not that I am aware of.You can do a lot of stuff like setting up a config file and do sysprep etc.But binaries are always needed.

  2. Hugo Shebbeare Avatar

    Love it, thank you! Have enjoyed cmd line for all the smart updates, but this was not obvious at first.:)

    1. Anup Avatar

      Thank you. Glad that you enjoyed it.

    2. Anup Avatar

      Thanks for the feedback. Glad you enjoyed the post !

  3. Vinod Avatar

    Works like a charm! Thanks for this post. Didn’t find a lot of help in this regard elsewhere. I had to uninstall 16 instances on 2 machines each. Imagine my plight! 🙂

    1. Anup Avatar

      Glad to hear that Vinod…This motivates me to write more !

  4. Byju Raj Avatar

    Hi Anup,
    Can this command be initiated through a batch file? I tried, but it did not work for me. If yes, please post a reply.

    -Byju

    1. AnupWarrier Avatar

      You can use powershell to do an unattended install

  5. Wilfred Avatar

    very easy way to uninstall an instanbce, thanks!

    1. AnupWarrier Avatar

      Thanks for the feedback!

  6. Balakrishna kola Avatar
    Balakrishna kola

    Thank you so much, this command line is working with silent uninstallation.

    1. AnupWarrier Avatar

      Excellent, thanks!

  7. Adabala Gopinandan Avatar

    HI Buddy
    i really like the post, i helped me a lot
    but when i am trying yo keep this in batch and calling it with parameters.
    it is not taking SQL,IS,RS,AS as a single parameter.
    can you help me in this?

Leave a reply to Vinod Cancel reply