Role from MSCluster_Network for cluster communications method

(imported topic written by SystemAdmin)

Im trying to get the Cluster network communication type from WMI,

Q: (substrings after “=” of (selects “Role from MSCluster_Network” of wmi “root\mscluster” as string))

A: 1

A: 3

I then wanted to translate it to a human readable format, but im getting stuck

Q: (preceding text of first “;” of following text of substrings ((substrings after “=” of (selects “Role from MSCluster_Network” of wmi “root\mscluster” as string)) & “,” ) of (“0,None;1,Cluster;2,Client;3,Both;”))

E: A singular expression is required.

and then replace the line below to reflect the name, Address, Role

Q: ((string value of property “Name” of it, string value of property “Address” of it, string value of property “Role” of it ) of select objects “Name, Address, Role from MSCluster_Network” of wmi “root\MSCluster”)

A: private, 10.10.10.0, 1

A: public, 172.16.4.121, 3

“0,None;1,Cluster;2,Client;3,Both;”

Output would look like this

A: private, 10.10.10.0, Cluster

A: public, 172.16.4.121, Both

(imported comment written by NoahSalzman)

Here is one way to do it:

(items 0 of it, items 1 of it, (if (it = 0) then “None” else (if (it = 1) then “Cluster” else (if (it =2) then “Client” else “Both”))) of items 2 of it) of ((string value of property “Name” of it, string value of property “Address” of it, string value of property “Role” of it ) of select objects “Name, Address, Role from MSCluster_Network” of wmi “root\MSCluster”)

I haven’t tested that specific combination, but I do know that this test version works:

(items 0 of it, items 1 of it, (if (it = 0) then “None” else (if (it = 1) then “Cluster” else (if (it =2) then “Client” else “Both”))) of items 2 of it) of (“private”, “10.10.10.0”, 1; “public”, “172.16.4.121”, 3)

(imported comment written by SystemAdmin)

Thanks Noah,

I have modified it slightly

concatenation "; " of ((string value of property “Name” of it, string value of property “Address” of it ,((if (it=“0”) then “None” else if (it=“1”) then “Cluster” else if (it=“2”) then “Client” else if (it=“3”) then “Both” else “Unknown Role”) of (string value of property “Role” of it))) of select objects “Name, Address, Role from MSCluster_Network” of wmi “root\MSCluster” as string)

I have attached a simple Cluster Analysis if any one is interested

(imported comment written by SystemAdmin)

I am very interested in your cluster analysis, but the attachment doesn’t work for me. Can you please re-attach, or send it directly to me?

Thanks!

Jim

(imported comment written by SystemAdmin)

Try this one…

otherwise here’s all the pieces

Cluster Name

if (exists key 
"HKEY_LOCAL_MACHINE\Cluster" of registry) then (value 
"ClusterName" of key 
"HKEY_LOCAL_MACHINE\Cluster" of 

native registry as string) 

else 
"<No Value Exists>"

Node State

concatenation 
"; " of ((string value of property 
"Name" of it, ((

if (it=
"-1") then 
"StateUnknown" 

else 

if (it=
"0") then 
"Up" 

else 

if (it=
"1") then 
"Down" 

else 

if (it=
"2") then 
"Paused" 

else 

if (it=
"3") then 
"Joining" 

else 
"relevance unknown") of (string value of property 
"State" of it))) of select objects 
"Name, State from MSCluster_Node" of wmi 
"root\MSCluster" as string)

Resource Node Info

concatenation 
"; " of (((substring between 
"%22" of item 0 of it, substring between 
"%22" of item 1 of it) of (string value of property 
"PartComponent" of it, string value of property 
"GroupComponent" of it ) of select objects 
"PartComponent, GroupComponent from MSCluster_NodeToActiveGroup" of wmi 
"root\MSCluster") as string)

Resource Group Info

concatenation 
"; " of ((item 0 of item 0 of it, item 1 of item 0 of it, item 1 of item 1 of it) of (((substring between 
"%22" of item 0 of it, substring between 
"%22" of item 1 of it) of (string value of property 
"PartComponent" of it, string value of property 
"GroupComponent" of it ) of select objects 
"PartComponent, GroupComponent from MSCluster_NodeToActiveGroup" of wmi 
"root\MSCluster"),((string value of property 
"Name" of it, ((

if (it=
"-1") then 
"StateUnknown" 

else 

if (it=
"0") then 
"Up" 

else 

if (it=
"1") then 
"Down" 

else 

if (it=
"2") then 
"Paused" 

else 

if (it=
"3") then 
"Joining" 

else 
"relevance unknown") of (string value of property 
"State" of it))) of select objects 
"Name, State from MSCluster_Node" of wmi 
"root\MSCluster")) whose (item 1 of item 0 of it = item 0 of item 1 of it) as string)

Quorum Disk

substring after 
"=" of (selects 
"MaintenanceFile from MSCluster_Cluster" of wmi 
"root\mscluster" as string)

Description

substring after 
"=" of (selects 
"Description from MSCluster_Cluster" of wmi 
"root\mscluster" as string)

Event Log Replication

substring after 
"=" of (selects 
"EnableEventLogReplication from MSCluster_Cluster" of wmi 
"root\mscluster" as string)

IP Name / Info / Role

concatenation 
"; " of ((string value of property 
"Name" of it, string value of property 
"Address" of it ,((

if (it=
"0") then 
"None" 

else 

if (it=
"1") then 
"Cluster" 

else 

if (it=
"2") then 
"Client" 

else 

if (it=
"3") then 
"Both" 

else 
"Unknown Role") of (string value of property 
"Role" of it))) of select objects 
"Name, Address, Role from MSCluster_Network" of wmi 
"root\MSCluster" as string)
1 Like

(imported comment written by SystemAdmin)

Thanks, Mark, I will give that a go. I’ve been wanting to go down this road for awhile now to replace a different script that is querying clusters directly. I appreciate the quick reply!

(imported comment written by SystemAdmin)

As you can see i get most of the data is from the same general location in WMI, and there’s lots more information available, if you update this Analysis please repost it back to the forum…

thanks