Error 0x800f0922 Enabling Or Installing .Net 3.5 On Windows 8.1

Just a note, if you want to skip the narrative, the fix is at the bottom of the post, but if, like my GCSE maths teacher, Mrs Williams, you want me to show my working out, keep reading.

I’d been having some trouble installing .Net 3.5 on a Windows 8.1 machine for a while, seeing the same error no matter how I attempted the install. Turning the feature on through Windows features just threw a generic error which was of little help. Trying the same action directly on the command line via dism.exe, gave some detail in the dism.log file.

So, I ran dism.exe /online /enable-feature /featurename:NetFX3 on the command line and then checked the result in the dsim.log file, located at C:\Windows\Logs\DISM\dism.log

The two interesting lines in this are shown below;
DISM DISM Package Manager: PID=4564 TID=796 Failed while processing command enable-feature. - CPackageManagerCLIHandler::ExecuteCmdLine(hr:0x800f0922)
DISM DISM Package Manager: PID=4564 TID=796 Further logs for online package and feature related operations can be found at %WINDIR%\logs\CBS\cbs.log - CPackageManagerCLIHandler::ExecuteCmdLine

The CBS log file revealed a little further info in the following line;

CBS Failed to perform operation. [HRESULT = 0x800f0922 - CBS_E_INSTALLERS_FAILED]

When I did a bit more digging on that error, I found the following post, How to troubleshoot error 0x800F081F when installing roles and features. which admittedly is a totally different error, but there, like a diamond in the rough, was a comment pointing to corrupt performance counters and referenced another Microsoft blog post, Unable to install IIS Web Server Role – “The configuration registry key is invalid”.

The pearl of wisdom from these was to run lodctr /r from the command line, and then re-run the install.

Success, it worked, and I hope this at least proves helpful for someone else, as late at night and trying to fix this for someone who had a deadline looming to get some machines setup, it was a real problem to figure out.