Solving Multiple 4001 and 4201 Error events in Operations Manager Log

Problem:
In Operations Manager log I observed multiple 4001 and 4201 Error and Warning Log Entries with reason: Invalid classHere are few log samples:

Management Group: CONTMAN. Script: Main Module: CPUUsagePercentDataSource.ps1 Version: 6.7.7.0 : 
Error occured during CPU Usage for SQL Instances data source executing.
Computer:Server01 
Reason: Invalid class  
Position:33 
Offset:27
Detailed error output: Invalid class

Management Group: CONTMAN. Script: GetSQL2014DBFilesFreeSpace.vbs. Version: 6.7.7.0 : The next errors occured:
Cannot get a list of enabled Sql Server protocols
 Error Number: -2147217392
 Description: Invalid class 
 Instance: NAMEDINST
 
Management Group: CONTMAN. Script: DiscoverSQL2014DBEngineDiscovery.vbs. Version: 6.7.7.0 : The next errors occured:
The Query 'select * from SqlService where SQLServiceType ='1'' did not return any valid instances.  Please check to see if this is a valid WMI Query.: Invalid class

We can see problem might be related to WMI. In the last sample we even have WQL query which for some reason failed: ‘select * from SqlService where SQLServiceType =’1” did not return any valid instances.

I Listed namespaces in root\microsoft\SqlServer:
listnamespaces

Get-WmiObject -Namespace root\microsoft\SqlServer -Class __Namespace | select Name | sort Name 

Then I ran the above query for all three Namespaces:

Get-WmiObject -Namespace root\microsoft\SqlServer\ComputerManagement10 -Query "select * from SqlService where SQLServiceType = '1'"

ComputerManagement10 (SQL 2008)=> Returned values
ComputerManagement11 (SQL 2012) => Returned error
ComputerManagement12 (SQL 2014) => Returned error

Error was:

Get-WmiObject : Invalid class
At line:1 char:14
+ Get-WmiObject <<<<  -Namespace root\microsoft\SqlServer\ComputerManagement11 
-Query "select * from SqlService where SQLServiceType = '1'"
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

After some digging I decided to rebuild WMI for 2012 and 2014 SQL.

recompilesqlmof

2012:

Set-Location 'C:\Program Files (x86)\Microsoft SQL Server\110\Shared'
mofcomp sqlmgmproviderxpsp2up.mof

2014:

Set-Location 'C:\Program Files (x86)\Microsoft SQL Server\120\Shared'
mofcomp sqlmgmproviderxpsp2up.mof

Once recompile is suceessfull we have a very nice and clean log  🙂
4001and4201

Just the way we like it.

Till next time..

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to Solving Multiple 4001 and 4201 Error events in Operations Manager Log

  1. Tol says:

    How did you recompile to SQL 2008 R2?

  2. jurelab says:

    Hi Tol,

    It is documented in the above link.

    “C:\ProgramFiles(x86)\MicrosoftSQLServer\100\Shared\”
    then run:
    mofcomp sqlmgmproviderxpsp2up.mof

    Hope this helps
    Jure

  3. jaspervd86 says:

    Worked like a charm, thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s