WMI Invalid Class: Patch Rule Fails on Cluster Service Check

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.

Gouache painting of a brass microscope on a wooden table with a cracked glass slide on its stage and a vermilion adjustment screw

The Error

This is what we saw on the installation screen:

SQL Server patch setup screen listing rule checks, with the rule Not clustered or the cluster service is up and online marked Failed and a Rule Check Result dialog explaining that the cluster is not online or cannot be accessed from one of its nodes

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 : RulesEngineNotificationChannel

The 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.

WMI Control (Local) Properties dialog on the General tab, saying it failed to initialize all required WMI classes, with WMI: Invalid class highlighted for Win32_Processor, Win32_WMISetting and Win32_OperatingSystem

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

Administrator command prompt running mofcomp on cimwin32.mof, ending with the messages that the MOF file has been successfully parsed, data stored in the repository, and Done

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 %s

Confirm 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.

Quick reference card: Patch Rule: WMI Invalid Class

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.

SQL Error Messages, SQL Patch, SQL Server, SQL Server Cluster, Windows
Previous Post
Max Worker Count: Why Typing 10000 Slowed a Server
Next Post
Show Primary Key of a Table in SQL Server With sp_pkeys

Related Posts

12 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.