PowerShell v2 Getting Active Node Information and some WMIC

A developer on our team needed to know about some Clustered Node posts I had thrown out into cyberspace a few years back. Unable to give a great response I showed him a few ways to get the raw data from a cluster resource.  Here is the PowerShell command to get raw data:
Get-WmiObject -Class MSCluster_NodeToActiveResource -Namespace rootmscluster | format-table GroupComponent,PartComponent -AutoSize
This returns the GroupComponent and PartComponent data for a given server. You can point this to other clustered machines by simply using the -ComputerName parameter. With WMI there are all sorts of other complications that can come into the picture. This command works great for a local machine on which you are doing research.

The same information can be obtained from WMIC with the following commands on cmd.exe:
C:Userswill>wmic
wmic:rootcli>/namespace:rootmscluster
wmic:rootcli>context
NAMESPACE : rootmscluster
ROLE : rootcli
NODE(S) : server
IMPLEVEL : IMPERSONATE
[AUTHORITY : N/A]
AUTHLEVEL : PKTPRIVACY
LOCALE : ms_409
PRIVILEGES : ENABLE
TRACE : OFF
RECORD : N/A
INTERACTIVE : ON
FAILFAST : OFF
OUTPUT : STDOUT
APPEND : STDOUT
USER : N/A
AGGREGATE : ON

wmic:rootcli>path __namespace
Name
ms_409

wmic:rootcli>path MSCluster_NodeToActiveResource
This last command will output the same exact results you see when you run the Get-WmiObject cmdlet listed above.  Now, you have to understand how to use the data to be useful, but, it is good to have jotted down for reference. There are five steps outlined above, but, only three are truly necessary. Below are the steps to explain why I use these commands in this specific order:
  1. Launch wmic.exe.
  2. Switch to the rootmscluster namespace. This is where cluster data resides.
  3. (Not required) Verify you are in the rootmscluster namespace
  4. (Not required) Check the namespace.
  5. Enumerate the objects data with the path parameter.
For good measure, here is a link to actually be productive with the data:
Finding Which Cluster Node a Resource is Currently Via Powershell & WMI

Related Posts by Categories

0 comments:

Post a Comment