A WMI invalid class error can sit behind a patch rule failure that looks like a cluster problem. In my consulting work, I’ve seen the same error from several causes. This one appeared while installing a service pack or cumulative update of SQL Server in a clustered environment. The rule that failed was Not clustered or the cluster service is up and online.

The Error
This is what we saw on the installation screen:

Rule "Not clustered or the cluster service is up and online." failed.
The machine is clustered, but the cluster is not online or cannot be accessed from one of its nodes. To continue determine why the cluster is not online and rerun setup instead of rerunning the rule since the rule can no longer detect a cluster environment correctly.What Happened
I had written an earlier post on the same error. Its solution didn’t help this time, so we looked into Detail.txt, one of the log files setup generates. This is where it failed:
Slp: Initializing rule : Not clustered or the cluster service is up and online.
Slp: Rule is will be executed : True
Slp: Init rule target object: Microsoft.SqlServer.Configuration.Cluster.Rules.ClusterServiceFacet
Slp: Invalid class
Slp: at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at Microsoft.SqlServer.Configuration.Cluster.Rules.WMIInterop.Service.ServiceCollection.ServiceEnumerator.MoveNext()
at Microsoft.SqlServer.Configuration.Cluster.Rules.ClusterServiceFacet.Microsoft.SqlServer.Configuration.RulesEngineExtension.IRuleInitialize.Init(String ruleId)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.Execute(Boolean stopOnFailure)
Slp: Rule initialization failed - hence the rule result is assigned as Failed
Slp: Send result to channel : RulesEngineNotificationChannelThe error message was similar to the earlier post, but the stack was different.
Why It Happens
When I saw Invalid class, this looked like an issue with the WMI state on the machine. The rule asks WMI about the cluster service. If WMI can’t answer, the rule fails to initialize, and setup marks it as Failed.
How to Check
To confirm it, launch the WMI MMC snap-in. Click Start, then Run, type WMIMGMT.MSC and press Enter. In the window that opens, right-click WMI Control (Local) and click Properties. If you see messages like the ones below, follow the fix.

This confirms that Windows WMI is broken and we need to recompile the MOF files.
The Fix
For my client, this command worked:
mofcomp C:\Windows\System32\WBEM\cimwin32.mof
If that doesn’t work, you can compile all the MOF files with this script:
CD C:\Windows\System32\WBEM
dir /b *.mof *.mfl | findstr /v /i uninstall > allmoflist.txt & for /F %s in (allmoflist.txt) do mofcomp %sConfirm It Worked
Open the WMI Control properties again and run the patch. The invalid class messages should be gone, and the rule should pass.
How to Prevent It
When a rule fails with a message you have seen before, don’t stop at the first fix. Read Detail.txt, because a different stack can mean a different cause.
Please let me know in the comments if this helped you.

An invalid class is not a cluster problem, it is a broken WMI repository.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.





12 Comments. Leave new
Thanks!!
This saved me! Thank you!
Worked like a charm. Thanks.
Thanks man!
Worked a treat! Super Star!!!
Was getting the following error during Windows Update installing the following patch on Windows 10 Pro. for SQL Server 2019 Dev Edition…
Security Update for SQL Server 2019 RTM GDR (KB5014356)
Download error – 0x80070643
Tried installing the patch manually and got the “Not clustered or the cluster service is up and online” validation error.
Confirmed the WMI state issue (Invalid Class) and later fixed it by using your suggested solution:
mofcomp C:\Windows\System32\WBEM\cimwin32.mof
Worked perfectly…thank you!
Worked for me, Thank you
Muchas gracias Maestro me funciono al 100%
Thanks This was a fix for me too. Never heard of mof files nor that they were related to SQL issues.
Worked perfectly. Thank you!
Thanks a lot, you save more than my professors. Greetings from Argentina.
This fixed the issue!