Sql Express install failure

mark levy 0 Reputation points
2026-11-07T03:06:47.72+00:00

Getting SQL express 2022 install failure:

azure extension - turned off

Features: PolyBase off all others on (including localdb sharing)

only windows authentication on

Error:

TITLE: Microsoft SQL Server 2022 Setup


The following error has occurred:

The MOF compiler could not connect with the WMI server. This is either because of a semantic error such as an incompatibility with the existing WMI repository or an actual error such as the failure of the WMI server to start.

For help, click: https://go.microsoft.com/fwlink?LinkID=2209051&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=16.0.1000.6&EvtType=0xA60E3551%25400xD3BEBD98%25401211%25401


there is also a PerfLib error:

TITLE: Microsoft SQL Server 2022 Setup


The following error has occurred:

PerfLib 2.0 counter removal failed with exit code -2147024894. Command line: C:\WINDOWS\system32\unlodctr.exe /m:hkengperfctr.xml from directory C:\Program Files\Microsoft SQL Server\160\Shared.

I keep deleting SQL files and cleaning the registry with no luck.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-11-07T03:07:38.2233333+00:00

    Repair the Windows WMI repository first, rebuild the performance counters, and then remove any inactive SQL instance through SQL Setup rather than deleting more files or registry keys.

    1. Validate and repair WMI

    Open Command Prompt as Administrator and run:

    winmgmt /verifyrepository
    
    • If the result says the repository is consistent, do not reset it; continue to the performance-counter repair.
    • If it reports an inconsistency, run:
    winmgmt /salvagerepository
    winmgmt /verifyrepository
    

    /salvagerepository checks the repository and rebuilds it only when an inconsistency is detected, while merging readable content into the rebuilt repository. Microsoft advises against deleting or resetting the WMI repository as a first action because that can damage Windows or installed applications.^1^

    If verification remains inconsistent after salvage, stop before using /resetrepository; some application namespaces do not rebuild automatically after a reset.^2^

    2. Rebuild and resynchronize the performance counters

    In an elevated Command Prompt, run the counter rebuilds for both 64-bit and 32-bit libraries:

    cd /d C:\Windows\System32
    lodctr /R
    cd /d C:\Windows\SysWOW64
    lodctr /R
    winmgmt /resyncperf
    

    Then open PowerShell as Administrator and restart the related services:

    Get-Service -Name "pla" | Restart-Service -Verbose
    Get-Service -Name "winmgmt" | Restart-Service -Force -Verbose
    

    These are Microsoft’s documented commands for rebuilding all performance counters and resynchronizing them with WMI.^3^

    The unlodctr failure can occur when the application’s expected Performance registry key is absent; that key must exist for counter removal to succeed.^4^ Do not manually recreate or delete those keys at this stage.

    Restart Windows after completing both repairs.

    3. Remove any partial SQL installation safely

    Because several installation attempts and manual cleanup have already occurred, check whether Setup left an inactive instance:

    1. Preserve the latest folder under:
         C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\<timestamp>
      
    2. Open Summary.txt. If it provides an uninstall command, run that exact command from an elevated command prompt using matching SQL Server 2022 media.
    3. Start SQL Server Installation Center → Tools → Installed SQL Server features discovery report.
    4. Check for an entry such as <InstanceName>.INACTIVE.
    5. If it remains, follow the discovery report’s product mapping and remove only Windows Installer product codes verified as belonging to that inactive instance.

    Microsoft explicitly advises against deleting SQL Server registry keys, services, folders, or files as general cleanup because shared components or working instances can be damaged.^5^

    If Summary.txt contains an uninstall command, its general form resembles:

    cd /d "<SQL2022-media-folder>"
    setup.exe /Q /ACTION=UNINSTALL /INSTANCEID=<InstanceId> /FEATURES=<FeatureList>
    

    Do not copy the placeholders literally or reuse values from another computer; use only the instance ID and feature list recorded in your Summary.txt.

    4. Retry Setup and inspect the first failure

    Retry from fresh SQL Server 2022 Express media stored on a local drive, running setup.exe as administrator. SQL Server 2022 requires an x64 processor; it is not supported on ARM.^6^

    If Setup fails again, identify the first error rather than later dependency failures:

    • Summary.txt: search for error and failed.
    • Latest timestamped Detail.txt: inspect the end, then search for error or exception.
    • Feature-specific MSI log: search for value 3 and inspect the surrounding lines.

    The logs are under %ProgramFiles%\Microsoft SQL Server\160\Setup Bootstrap\Log; the documented files and locations are listed here.^7^

    If WMI is consistent but SQL’s WMI provider remains broken and this file exists, recompile that provider:

    mofcomp "%programfiles(x86)%\Microsoft SQL Server\160\Shared\sqlmgmprovider.mof"
    powershell -NoProfile -Command "Get-Service winmgmt | Restart-Service -Force"
    

    If the file is under %ProgramFiles% instead, use its actual full path. If it is missing, do not run mofcomp; use SQL Setup repair to restore the missing provider files.^8^

    If salvage cannot make WMI consistent, or supported removal still leaves an inactive instance, preserve Summary.txt, Detail.txt, MSI logs, and the discovery report and escalate to Microsoft Support rather than continuing manual registry cleanup.


    References

    1. winmgmt
    2. Application installation common error codes reference
    3. Manually rebuild performance counters for Windows Server 2008 64 bit or Windows Server 2008 R2 systems
    4. Deleting Performance Counters
    5. Remove a partial installation of SQL Server
    6. Troubleshoot SQL Server installation errors
    7. View and read SQL Server Setup log files
    8. Cannot connect to WMI provider error in SQL Server Configuration Manager
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.