Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Error when Querying WMI Namespace: root/MSCluster

Doug5
Tera Contributor

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

8 REPLIES 8

Within pattern designer, there is a debug mode available. It's a button at the top of the pattern designer window that you can select and choose a MID and device to debug the pattern against.

Hey @Doug5,

 

Have you checked if the account you use for discovery has access to the WMI namespace (root\MSCluster)

 

Try this query from your MID, this will tell you if that namespace is available. If this is available, then probably there is no proper access permissions to the namespace.

 

Get-WmiObject -Namespace "root" -ClassName __Namespace -Credential <name_of_the_account> -ComputerName <remote_host_name> | foreach Name

  

Let me know if you are able to find something with this.

 

Regards,
Bhavani Shankar
Linked In

Yes.  I have thank you.  I did run that Query.  See my PowerShell script above.  The Output from my PowerShell indicates that the child Namespace  root/MSCluster does not exist - so my Question is: Why is the pattern trying to query root/MSCluster when it does not exist?

Thank you.  I will take a look.