TECH / Windows 3 min read

How to Rebuild Windows Performance Counters (Perflib and SQL Server Error Fix)

Antonio NEMCD Author
Published May 26, 2012 · 3 min

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.”

Perflib registry key with populated Counter and Help multi-string values

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.

  1. Press Win+R, type regedit, and press Enter.
  2. Navigate to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
  1. Look for Disable Performance Counters: if it exists and is set to 1, change its value to 0 (or delete the value).

Setting Disable Performance Counters to 0 in Perflib registry key

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\Perflib key, check the decimal values of Last Counter and Last Help.
  • Double-click Counter inside Perflib\009 (and your local language subkey) and scroll to the very bottom – the highest number in Counter must match Last Counter, and the highest number in Help must match Last 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.

Related posts:

Leave a Comment