Last active
December 5, 2021 12:18
-
-
Save mikerodionov/25a485a292422702b08ade10dd9f9d34 to your computer and use it in GitHub Desktop.
Cleanup of SQL components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is something which can be useful if you run into error message below during SQL Server installation | |
# The MOF compiler could not connect with the WMI server - Error in UI | |
# MSINEWINSTANCE requires a new instance that is not installed - Error in SQL installer logs | |
# View all installed components which name contains SQL | |
Get-WmiObject -Query "SELECT * FROM win32_product Where Caption like '%SQL%'" | Select Caption, IdentifyingNumber | |
# Build a list of commands to uninstall all of them | |
$components_to_delete = Get-WmiObject -Query "SELECT * FROM win32_product Where Caption like '%SQL%'" | Select -ExpandProperty IdentifyingNumber | |
foreach ($component in $components_to_delete) { | |
echo "msixec /x $component" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment