How to Rebuild Windows Performance Counters (Perflib and SQL Server Error Fix)
When installing Microsoft SQL Server (or setting up Zabbix, Prometheus, or Windows Performance Monitor perfmon.exe), the setup wizard can halt at PerfMonCounterNotCorruptedCheck with the error: “Performance counter registry hive consistency check failed. The performance counter registry hive is corrupted.”
On a healthy Windows system, the Registry subkeys Perflib\009 (English) and your localized language subkey (such as Perflib\019) contain long multi-line Counter and Help lists. If those values are missing or out of sync with Last Counter / Last Help, SQL Server refuses to continue.
Step 1 (The Hidden Culprit). Check Disable Performance Counters in the Registry
Most guides immediately tell you to run lodctr /R, switch regional settings, or export Registry keys from another machine. When I hit this error myself, none of those worked – Windows simply refused to populate the counter lists.
The real cause was a single Registry flag that had disabled counters globally: Disable Performance Counters = 1.
- Press
Win+R, typeregedit, and press Enter. - Navigate to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
- Look for
Disable Performance Counters: if it exists and is set to1, change its value to0(or delete the value).
System “tweaker” utilities and buggy uninstallers occasionally flip this value to 1, which silently blocks lodctr from rebuilding anything.
Step 2. Rebuild the Counter Library With lodctr /R
Once Disable Performance Counters is set to 0, open Command Prompt as Administrator and rebuild the performance counters from Windows’ system INI files (on 64-bit Windows, run it in both System32 and SysWOW64):
cd /d C:\Windows\System32
lodctr /R
cd /d C:\Windows\SysWOW64
lodctr /R
winmgmt.exe /RESYNCPERF
Note that the /R switch must be uppercase. Reboot (or restart the WMI service) and refresh Perflib\009 in regedit – the Counter and Help multi-string values should now be fully populated.
Step 3. Verify Last Counter and Last Help (For SQL Server Setup)
SQL Server’s PerfMonCounterNotCorruptedCheck compares two pairs of numbers:
- In the parent
...\CurrentVersion\Perflibkey, check the decimal values ofLast CounterandLast Help. - Double-click
CounterinsidePerflib\009(and your local language subkey) and scroll to the very bottom – the highest number inCountermust matchLast Counter, and the highest number inHelpmust matchLast Help.
Setting Disable Performance Counters = 0 followed by lodctr /R syncs those numbers automatically, and clicking “Re-run” in the SQL Server installer immediately passes the check.

