Recompiling the MOFs are a commonly suggested solution all around the internet. Then I found this article that states:
Note: Under almost no circumstance should you use the script that
rebuilds the WMI repository from the MOF files
The script is inherently flawed, for 2 reasons:
If you navigate to the %systemroot%system32wbem folder, and list the
MOF files, you see find MOFs named (some provider name)_ uninstall.mof
. When you mofcomp those, they remove the classes in the MOF. The
script mofcomps everything, so it can very easily install then
immediately uninstall the classes, resulting in the class not being
accessible.
Replaying mofs is often sequence dependent. Example:
classes in mof1 can depend on or have associations with classes in
mof2. If they aren't present, MOFCOMP will not insert the classes.
It's extremely difficult to know what is / is not the right sequence,
so any script that simply MOFCOMPs everything is not going to be fully
successful.
In addition to causing damage to your system that's almost impossible
to fix correctly, if you take that approach you will blow away all
information that could be used to determine the root-cause.
We can guard against the uninstall MOFs by excluding them, but this doesn't address the concern about order of operations. This will compile them alphabetically. If a MOF is compiled before it's dependencies, you will end up with an incomplete namespace model.
So while this is a bit safer, it is still not a perfect solution:
Push-Location "$Env:WinDir\System32\Wbem"
Get-ChildItem -Path * -Exclude "*uninstall*" -Force -File | Where-Object extension -match '\.(mof|mfl)' | ForEach-Object {mofcomp "$($_.Name)"}
Get-ChildItem -force -file | Where-Object extension -match '\.dll' | ForEach-Object {regSvr32 /s "$($_.FullName)"}
Restart-Service winmgmt -force
gpupdate /force