SQL Server Cleanup Using UninstallString When Programs and Features Entry is Missing

Issue

In some environments, SQL Server services may still exist on the server, but the related SQL Server entries are missing from Programs and Features. This can happen due to missing or corrupted registry entries, incomplete uninstallations, or failed patching activities.

To identify the uninstall information from the registry, the following PowerShell script can be used:

Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*, `
HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object { $_.DisplayName -like “*SQL Server 2016*” } |
Select-Object DisplayName, UninstallString

Solution

The above script helps retrieve the UninstallString for SQL Server components directly from the registry.

In many cases, the uninstall command may contain:

/I

For uninstallation, this should be replaced with:

/X

Example:

MsiExec.exe /x

This forces the uninstall operation instead of launching the installer in maintenance mode.


Important Remarks

  • This approach should mainly be considered for remote support cases or emergency cleanup situations.
  • There is always a possibility of future issues when manually cleaning up SQL Server components using registry-based uninstall methods.
  • The recommended and safest approach is always to rebuild the server if SQL Server installation metadata or registry entries are heavily corrupted.
  • Use this method only as a last resort and proceed at your own risk.

Summary

When SQL Server entries are missing from Programs and Features, the uninstall details can still be retrieved from the Windows registry using PowerShell. Replacing /I with /X in the uninstall command can help remove orphaned SQL Server components. However, since this method relies on registry-based cleanup, it should only be used cautiously in exceptional scenarios, with server rebuild remaining the preferred long-term solution.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

SQL Server 2022 In-Place Upgrade fails with message install the .NET Framework 2.0 or 4.0

Introduction:
Upgrading SQL Server is a crucial task, ensuring your database stays up-to-date and secure. Recently, during an attempt to upgrade from SQL Server 2016 to SQL Server 2022, an unexpected error surfaced, hindering the process.

Error Encountered:
The upgrade process halted with the following error message: The Microsoft .NET Framework 2.0 or 4.0 must be installed on your computer before you can install Microsoft SQL Server 2022 Setup Support Files. Please install the .NET Framework 2.0 or 4.0 and then install Microsoft SQL Server 2022 Setup Support Files.”

Below error was found on the installation summary,

Feature: Database Engine Services
Status: Failed
Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
Next Step: Use the following information to resolve the error, and then try the setup process again.
Component name: SQL Server Setup Support Files
Component error code: -2147483648
Component log file: C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\20231027_113110\SqlSupport_Cpu64_1.log
Error description: The Microsoft .NET Framework 2.0 or 4.0 must be installed on your computer before you can install Microsoft SQL Server 2022 Setup Support Files. Please install the .NET Framework 2.0 or 4.0 and then install Microsoft SQL Server 2022 Setup Support Files.
Error help link: https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=16.0.1000.6&EvtType=SqlSupport.msi%40CA_ErrorPrereqDotNet20Or40%40-2147483648

-> Below message found on C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\20231027_113110\SqlSupport_Cpu64_1.log,

MSI (s) (74:04) [12:15:03:056]: Doing action: CA_ErrorPrereqDotNet20Or40
Action ended 12:15:03: IsDotNet20Or40Installed. Return value 1.
Action start 12:15:03: CA_ErrorPrereqDotNet20Or40.
MSI (s) (74:04) [12:18:22:923]: Product: Microsoft SQL Server 2022 Setup (English) — The Microsoft .NET Framework 2.0 or 4.0 must be installed on your computer before you can install Microsoft SQL Server 2022 Setup Support Files. Please install the .NET Framework 2.0 or 4.0 and then install Microsoft SQL Server 2022 Setup Support Files.

The Microsoft .NET Framework 2.0 or 4.0 must be installed on your computer before you can install Microsoft SQL Server 2022 Setup Support Files. Please install the .NET Framework 2.0 or 4.0 and then install Microsoft SQL Server 2022 Setup Support Files.
Action ended 12:18:22: CA_ErrorPrereqDotNet20Or40. Return value 3.
Action ended 12:18:22: INSTALL. Return value 3.
Property(S): DiskPrompt = [1]
Property(S): InstallMode = Typical
Property(S): UpgradeCode = {DFF9DA09-88B8-4A80-BE2B-78A4DA9835FA}
Property(S): WelcomeBmp = WelcomeBmp
Property(S): OPENREADME = 1
Property(S): TARGETDIR = C:\

Investigation:
Upon inspection, the system seemingly met the .NET requirements, specifically version 4.8. Perplexed by this discrepancy, a closer examination of the server configuration was initiated.

Troubleshooting Steps:

  1. Service Disabling: Two services, namely Avecto Defendpoint Service and Defendpoint BeyondInsight, were identified as potential culprits. They were promptly stopped and disabled, eliminating possible conflicts.
  2. Administrative Run: The upgrade process was restarted with elevated privileges, utilizing “Run as Administrator” mode, ensuring comprehensive access and control.

Resolution:
Executing the upgrade with administrative privileges resolved the issue. The process completed successfully, and SQL Server 2022 was installed seamlessly, guaranteeing the continuity of database operations.

Conclusion:
In the realm of system upgrades, unexpected errors can pose challenges. Swift and strategic troubleshooting, such as disabling conflicting services and employing administrative privileges, can lead to successful resolutions. This experience underscores the importance of meticulous preparation and proactive problem-solving in the face of unforeseen obstacles. 🚀

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

syntax error ( *EngineEdition != 11) (Microsoft.SqlServer.Management.Sdk.Sfc)

-> I tried checking the properties of a database and saw below error,

TITLE: Microsoft SQL Server Management Studio
syntax error ( *EngineEdition != 11) (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476

-> The error basically complains that EngineEdition is not equal to 11 which is SQL Server 2012, but I am on SQL Server 2019.

-> I tried executing below query to check the database properties,

select * from sys.databases where database_id=db_id('JBSDB')

-> The compatibility_level for the database is set to 100 which is SQL Server 2008/ 2008 R2. SQL Server 2019 supports compatibility level starting 100. So not sure why are we seeing this error,

-> I upgraded SSMS to 18.11.1 https://docs.microsoft.com/en-us/sql/ssms/release-notes-ssms?view=sql-server-ver15 and the issue never occurred again.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.