I have created a script to uninstall only SSMS 18.10 and retain SSMS 19.3. I observe the registry keys are getting removed and folder in Program Files are getting removed . But the issue is after uninstall the entry in control panel still exist. Please suggest on this
Get the list of installed applications and filter by SSMS version
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Version -like “15.0.18390.0” }
$app1 = Get-WmiObject -Class Win32_Product | Where-Object { $.Name -like “isolated” -and $.Version -like “15.0.28307.421” }
$app2 = Get-WmiObject -Class Win32_Product | Where-Object { $.Name -like “Integration services” -and $.Version -like “15.0.2000.168” }
$app3 = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like “Microsoft SQL Server 2012 Native Client” }
$app_new = @($app,$app1,$app2,$app3)
$app_new
Check if the application is found
if ($app_new) {
# Uninstall the application
$app_new | ForEach-Object {
Write-Host “Uninstalling: $($.Name) - Version: $($.Version)”
$_.Uninstall()
}
}
Delete the SSMS 18.10 registry key
Remove-Item -Path “Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SQL Server Management Studio\18” -Recurse -Force
Remove-Item ‘C:\Program Files (x86)\Microsoft SQL Server Management Studio 18’ -Recurse -Force