How to use lodctr to resolve Event ID 1008 or 3009 Perflib or LoadPerf issues

Trix M 11 Reputation points
2022-10-05T08:20:08.687+00:00

This isn't actually a question. The answer below will reconstruct information that went missing from the old Technet forums question: How to use lodctr to resolve Event ID 1008 issue, which has been linked in a number of other places. It's not the exact text of the old article, since much of it was screenshots, but recreates the essential information.

Errors appear in the Application Event Log similar to the following:

Perflib
Event ID: 1008
The Open Procedure for service "BITS" in DLL "C:\Windows\System32\bitsperf.dll" failed. Performance data for this service will not be available.

Loadperf
Event ID: 3009
Installing the performance counter strings for service .NET Data Provider for SqlServer ( ) failed.

The answer describes how to rebuild performance counters from the associated DLL or INI files using LODCTR. It won't resolve every performance counter issue on Windows machines, but it is useful to try first. The steps have been tested on various server and workstation versions of Windows, up to Windows 10/Server 2019.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,555 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,718 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,072 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Trix M 11 Reputation points
    2022-10-05T09:04:18.58+00:00

    Rebuilding faulty performance counters with LODCTR.exe.

    1. Open a command prompt as Administrator on the affected machine.
    2. In the Application event log, identify the faulty service name in the event text. Note in event 1008, the performance counter DLL file path is listed in full - you can skip directly to step 4.
    3. Identify the performance counter DLL path, with LODCTR /Q:<ServiceName>. (Most of the dlls are in %systemroot%\system32, but others - like the .Net counter dlls - are in their own directory.) Put quotes around the service name if it has spaces. Run the following command and copy the Dll Name: path. C:>lodctr /q:".NET Data Provider for SqlServer"
      Performance Counter ID Queries [PERFLIB]:
      Base Index: 0x00000737 (1847)
      Last Counter Text ID: 0x00002CB8 (11448)
      Last Help Text ID: 0x00002CB9 (11449)
      [.NET Data Provider for SqlServer] Performance Counters (Enabled)
      DLL Name: %systemroot%\system32\netfxperf.dll
      Open Procedure: OpenPerformanceData
      Collect Procedure: CollectPerformanceData
      Close Procedure: ClosePerformanceData
    4. Rebuild the counter from the dll with LODCTR /R <dllPath> - with any luck, it'll successfully rebuild the counter settings. C:>lodctr /r %systemroot%\system32\netfxperf.dll
      Info: Successfully rebuilt performance counter setting from system backup store

    If the above completes successfully, check that the application event log shows no further errors and you're done.

    ----------

    If LODCTR /R throws an error, the counter needs to be rebuilt from its INI files. E.g.:

    C:\>lodctr /r %systemroot%\system32\bitsperf.dll  
    Error: Unable to rebuild performance counter setting from system backup store, error code is 2  
    

    Rebuilding the performance counters from the INI files can take a bit longer, depending on how many there are. To identify the INI files and rebuild the counters:

    1. Query the registry under HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>\Performance. The performance counter INI file name is listed in the PerfIniFile value. C:>reg query HKLM\SYSTEM\CurrentControlSet\Services\BITS\Performance /v PerfIniFile
      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BITS\Performance
      PerfIniFile REG_SZ bitsctrs.ini
    2. Locate the matching INI file(s) in the C:\Windows\INF\<ServiceName> directory. Don't forget the * in front of the INI file name when searching from the <ServiceName> parent directory (since the INIs are generally in one or more subdirectories). C:>dir /b /s C:\Windows\INF\bits*bitsctrs.ini
      C:\Windows\INF\bits\0000\bitsctrs.ini
      C:\Windows\INF\bits\0409\bitsctrs.ini
    3. Run LODCTR /R <inipath> on each of the INI files found in the service subdirectories. Make sure you have the correct full path for each INI. C:>lodctr /r C:\Windows\INF\bits\0000\bitsctrs.ini
      Info: Successfully rebuilt performance counter setting from system backup store C:>lodctr /r C:\Windows\INF\bits\0409\bitsctrs.ini
      Info: Successfully rebuilt performance counter setting from system backup store

    Alternatively, for step 3, you can use a one-line command to rebuild from all the matching counter INIs in the subdirectories under the parent service path.

    E.g.: FOR /R C:\Windows\INF\<ServiceName>\ %I IN (*bitsctrs.ini) DO lodctr /r %I

    C:\>FOR /R C:\Windows\INF\bits\ %I IN (*bitsctrs.ini) DO lodctr /r %I  
      
    C:\>lodctr /r C:\Windows\INF\bits\0000\bitsctrs.ini  
    Info: Successfully rebuilt performance counter setting from system backup store  
      
    C:\>lodctr /r C:\Windows\INF\bits\0409\bitsctrs.ini  
    Info: Successfully rebuilt performance counter setting from system backup store  
    

    If you want to check the correct file names are found in the previous command without executing lodctr, replace lodctr /r in the command line with echo. This should output the same paths for each INI file as the DIR command earlier:

    FOR /R C:\Windows\INF\bits\ %I IN (*bitsctrs.ini) DO echo %I

    After rebuilding the counter from the INIs completes successfully, check that there are no further errors in the Application Log.

    0 comments No comments

  2. Limitless Technology 39,336 Reputation points
    2022-10-06T14:54:51.707+00:00

    Hello there,

    Thank you for sharing the content in the forum. Additionally the below steps have helped users to resolve this issue

    1.Export branch [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BITS\Performance] to reg file
    2.Remove this keys in branch [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BITS\Performance]

    "First Counter"=dword:000010a6
    "Last Counter"=dword:000010b6
    "First Help"=dword:000010a7
    "Last Help"=dword:000010b7

    3.Reboot server.


    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments