SqlSetup: Should be able to uninstall features
I think SqlSetup should be able to uninstall features.
The best overview of doing this from command line was this old kb955404 that I found.
This would be helpful because the Azure SQL Server VM image installs a number of features, and we end up only using 1 or 2 on each machine. Currently, we are just turning the services off.
I @johlju I would like to have this work in SqlSetup so I put in all the information that I have on this issue: Here's an example of the command line to Uninstall SQL features:
Setup.exe /Action=Uninstall /FEATURES=SQL,AS,RS,IS,Tools /INSTANCENAME=MSSQLSERVER /Quiet
From what I understand, the SqlSetup already look for installed features and check for those missing when action=Install : Features found: SSMS,ADV_SSMS Unable to find feature 'SQLENGINE' among the installed features: 'SSMS,ADV_SSMS' Unable to find feature 'IS' among the installed features: 'SSMS,ADV_SSMS'.
So that should not be a problem to be able to construct the command line for action=Uninstall.
I know that if the only features to be removed are 'common features', the parameter /INSTANCENAME should not be used. If there is a least one parameter that is 'instance aware', everything can be uninstalled within the same command and with de /INSTANCENAME parameter.
For now, I see one issue with this : if we need to add features AND remove features, the setup.exe should be launched 2 times to do that. Is the SqlSetup resource can do that? Or do you think it should be another resource added to the SqlServerDsc module, something like SqlFeature ?
Thanks!
Great information around this! Great work!
If a user wants to uninstall instance ‘TEST’, then that is the desired state. The desired state is that target node should not contain a instance named ‘TEST’, so the same configuration should not be allowed to install an instance named ‘TEST’. Same I think goes for installing. The desired state should be to have an instance with the desired features. So if there should be more features to an already manually installed instance and there should be additional features installed, then I think already present and additional features are should be added to the Features parameter for the SqlSetup resources in the configuration. So if an SqlFeature resource is needed is if SqlSetup can not add features for one or more reasons? 🤔
I think we should use, if possible, the Features parameter to say what features to remove when the Action is uninstall. I don’t think we should remove everything? We should be able to uninstall say just AS?
I agree with that. I also think that this issue should be added to the project
I agree. This should be added to the project. I think the Uninstall should work exactly as the Install feature, there is not much missing for this to work.
Added it on the project board for SqlSetup configuration options.
I agree that it is probably not much that are missing, most work is probably in the unit (and integration ) tests. As an integration test maybe the existing SQL Server instance on the AppVeyor build worker could be installed (unless it needs a restart after). https://www.appveyor.com/docs/build-environment/#databases
Thanks
@johlju , any news on this uninstall feature? Will we be able to see this feature in future ?
As soon anyone in the community sends in a pull request with the necessary changes. Happy to review a PR for this.