Error when Querying WMI Namespace: root/MSCluster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I am getting this error in the MID Server log file (and in the Pattern Log). See ERROR below.
I ran some PowerShell (see below) to investigate this issue. My Question is Why is the Pattern querying the WMI Namespace root/MSCluster for most or all Windows Servers? This seams unnecessary and is causing unnecessary errors. You can see from my PowerShell output for WMI QUERY 1 that this Namespace does not exist. The Pattern should perform Query 1 first for all Windows Servers - and should only query root/MSCluster if this namespace is found to exist.
Have I made a mistake? Any thoughts?
=============================== ERROR ==========================================
2025-11-10T07:56:10.881+1300 DEBUG (Worker-Standard:HorizontalDiscoveryProbe-b7950bea338d3210323854b46d5c7b25) [APowerShellProvider:317] (168)APowerShellProvider - Error during execution of Windows command: executeQuery -Namespace root/MSCluster -Query "SELECT Caption,Description,Name,State,Status,Type,PrivateProperties FROM MSCluster_Resource". executeQuery : Could not get query SELECT Caption,Description,Name,State,Status,Type,PrivateProperties FROM MSCluster_Resource on namespace=root/MSCluster. Original Exception: The target namespace does not exist.
At line:1 char:5
+ & { executeQuery -Namespace root/MSCluster -Query "SELECT Caption,Des ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,executeQuery
com.snc.automation_common.integration.exceptions.InvalidCommandException: executeQuery : Could not get query SELECT Caption,Description,Name,State,Status,Type,PrivateProperties FROM MSCluster_Resource on namespace=root/MSCluster. Original Exception: The target namespace does not exist.
At line:1 char:5
+ & { executeQuery -Namespace root/MSCluster -Query "SELECT Caption,Des ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,executeQuery
#####################################################################
#################### POWERSHELL ####################################
#####################################################################
$UserName = "MERIDIAN\svc_iTOMAdminWindows"
$Password = "*********************"
# Convert the plain-text password to a SecureString
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
# Create the PSCredential object
$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
$Namespace = "Root\Microsoft\SqlServer\ComputerManagement13"
# $computer = "10.160.204.114"
$computer = "10.160.201.216"
Write-Host "`n ################### WMI QUERY 1 ######################"
$Query1 = "SELECT Name FROM __NAMESPACE"
$Result1 = Get-WmiObject -NameSpace "root" -Query $query1 -Computer $Computer -Credential $Credential -ErrorAction Stop
Write-Host $Result1
Write-Host "`n ################### WMI QUERY 2 ######################"
$Query2 = "SELECT Caption,Description,Name,State,Status,Type,PrivateProperties FROM MSCluster_Resource"
$Result2 = Get-WmiObject -NameSpace "root/MSCluster" -Query $query2 -Computer $Computer -Credential $Credential -ErrorAction Stop
Write-Host $Result2
============================= OUTPUT =====================================
################### WMI QUERY 1 ######################
__NAMESPACE.Name="subscription" __NAMESPACE.Name="DEFAULT" __NAMESPACE.Name="cimv2" __NAMESPACE.Name="msdt
c" __NAMESPACE.Name="Cli" __NAMESPACE.Name="Nap" __NAMESPACE.Name="SECURITY" __NAMESPACE.Name="SmsDm" __NA
MESPACE.Name="CCMVDI" __NAMESPACE.Name="RSOP" __NAMESPACE.Name="PEH" __NAMESPACE.Name="WebAdministration"
__NAMESPACE.Name="ccm" __NAMESPACE.Name="MEM" __NAMESPACE.Name="StandardCimv2" __NAMESPACE.Name="WMI" __NA
MESPACE.Name="AccessLogging" __NAMESPACE.Name="directory" __NAMESPACE.Name="Policy" __NAMESPACE.Name="Inve
ntoryLogging" __NAMESPACE.Name="Interop" __NAMESPACE.Name="Hardware" __NAMESPACE.Name="ServiceModel" __NAM
ESPACE.Name="Microsoft" __NAMESPACE.Name="Appv"
################### WMI QUERY 2 ######################
Get-WmiObject : Invalid namespace "root/MSCluster"
At C:\Users\a_dc38\Documents\test-Cluster.ps1:19 char:12
+ $Result2 = Get-WmiObject -NameSpace "root/MSCluster" -Query $query2 - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectComman
d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago
Hi,
your second query isn't conditional. Try wrapping it in an IF statement so it only runs if query 1 has an MSCluster value
$NamespaceExists = $Result1 | Where-Object { $_.Name -eq "MSCluster" }
if($NamespaceExists){
//do query 2
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Kieran
Thanks for the Update.
My second Query is not supposed to be Conditional. The purpose of the PowerShell was to determine why the OS Windows Pattern was throwing an error and to make sure that my Credentials has access to the appropriate WMI namespaces. I want to understand why the Pattern does not have an if state like you described. This would avoid errors in the Pattern. Also, if the Pattern generates more than 3 errors, the Pattern just stops. This can be configured using a system property. I find it rather surprising that the Pattern does not cope for this scenario. I posted this Article - so that when other Users do a search for this WMI error - they find this Question and don't waste time (as I have done) trying to diagnose a problem with one's Windows Credential (permissions or something) that does not exist. I currently, have several ServiceNow cases open about Pattern failures (such as for MS SQL) - where the initial diagnosis was lack of permissions in my Windows Credential. However, when I replicate the WMI Queries with PowerShell, there is no permissions problem. It has been a frustrating journey. Still unresolved. Thanks for your comments though. Much appreciated.
