WSUS: Installation fails with "PerfmonLoad routine returned error code" error

I was going over some of the issues we’ve been getting in the WSUS support group and came across one that seemed pretty interesting.  I didn’t see it documented anywhere so I thought I’d write it up here in case any of you happen to run across it.  The solution here was discovered by Joao Madureira, a Support Engineer for Windows Server Update Services.  Thank Joao!

========

Issue:  When attempting to install WSUS it may fail with:

Registering performance counters from sqlctr.ini
PerfmonLoad routine returned error code 6″

You may also see the following in the WMSDE log:

Starting custom action InstallPerfMon
Registering performance counters from sqlctr.ini
PerfmonLoad routine returned error code 6
Action ended 18:04:25: InstallFinalize. Return value 3.

Cause: Error 6 indicates an invalid handle so there’s some other process with an open handle to HKLMSOFTWAREMicrosoftWindows NTCurrentVersionPerflib.

Resolution: Run Process Monitor and examine each running process.  Find the process or service that has an open handle to HKLMSOFTWAREMicrosoftWindows NTCurrentVersionPerflib.  Once you identify the process or service, simply kill the process or stop the service and installation should complete successfully.

For more information on Process Monitor see http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx.

I hope none of you run into this issue but if you do maybe now you’ll have a head start in tracking down the cause.

J.C. Hornbeck | Manageability Knowledge Engineer