Skip to content

Instantly share code, notes, and snippets.

@mikerodionov
Last active December 5, 2021 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/25a485a292422702b08ade10dd9f9d34 to your computer and use it in GitHub Desktop.
Save mikerodionov/25a485a292422702b08ade10dd9f9d34 to your computer and use it in GitHub Desktop.
Cleanup of SQL components
# 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