Microsoft Monitoring Agent (SCOM / OMS Agent) setup failed with Error 25211

Recently I run into an issue at customer where the customer was not able to uninstall nor repair an SCOM Agent be using the MOMAgent.msi.
Every try to repair / uninstall / reinstall runs into the same Error message: 2017-03-14-10_58_58-snipping-tool

Symptom:
If you want to uninstall / reinstall / repair a Microsoft Monitoring Agent, the setup may fail with Error Code 25211.
In this scenario, you may not be able to repair nor uninstall the agents in any way.  An installation of an update rollup may also fail with the same error.
The logfile tells you something about performance counter could not be registered.

InstallCounters: LoadPerfCounterTextStrings() failed . Error Code: 0x80070057. momv3 "C:\Program Files\Microsoft Monitoring Agent\Agent\HealthServiceCounters.ini"
InstallPerfCountersHelper: pcCounterInstaller->InstallCounters() for the default counters failed. Error Code: 0x80070057. HealthService
InstallPerfCountersLib: InstallHealthServicePerfCounters() failed . Error Code: 0x80070057.
InstallPerfCountersLib: Retry Count : .

InstallCounters: LoadPerfCounterTextStrings() failed . Error Code: 0x80070057. momv3 "C:\Program Files\Microsoft Monitoring Agent\Agent\MOMConnectorCounters.ini"
InstallPerfCountersHelper: pcCounterInstaller->InstallCounters() for the default counters failed. Error Code: 0x80070057. MOMConnector
InstallPerfCountersLib: InstallHealthServicePerfCounters() failed . Error Code: 0x80070057.
InstallPerfCountersLib: Retry Count : .

Solution:

First I tried to rebuild the Performance library according to https://support.microsoft.com/kb/300956 without success.
Additional I tried to skip APM by using  msiexec.exe /i momagent.msi NOAPM=1 , unfortunately again without success.

Then I found a missing registry key, that points me to the underlying problem.

Please double check if the following registry keys are existing.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HealthService\Performance
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MOMConnector\Performance

If these keys are not existing anymore you can create them manually.
You only need to create the keys called "Performance", no additional values underneath.

After that you should be able to uninstall / repair the agent by using the MOMAgent.msi or MMASetup-AMD64.exe