locked
Remotely Retrieve Windows Failover Cluster Nodes RRS feed

  • Question

  • I am trying to write a script to have a node add itself to a Windows Failover Cluster without knowing what other nodes are part of the cluster.

    The first thing I want to do is check what nodes are part of the cluster.

    What does work is if I run....

    get-cluster NodeInCluster | get-clusternode

    Unfortunately I do not know the names of the nodes that are part of the cluster so I can't use the command above.  So I am trying to run this command...

    get-cluster -domain  xxx.xxx.xxx | Where-Object {$_.Name -eq 'XYZCluster'} | get-clusternode 

    The following commands seem to return the same objects, but running get-clusternode against them seems to prove that wrong.

    get-cluster NodeInCluster

    vs

    get-cluster -domain  xxx.xxx.xxx | Where-Object {$_.Name -eq 'XYZCluster'}


    • Edited by mtam_79 Wednesday, May 24, 2017 5:05 PM
    Wednesday, May 24, 2017 5:04 PM

All replies

  • Hi,

    i suppose you use this cmdlet enough:

    Get-ClusterNode

    https://technet.microsoft.com/en-us/library/ee460990.aspx

    Specifies the name of the cluster to run this cmdlet on. If you type "-Cluster ." or omit the parameter, the cmdlet runs on the local cluster.

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    • Edited by Hello_2018 Thursday, May 25, 2017 8:50 AM
    Thursday, May 25, 2017 8:50 AM
  • Get-ClusterNode only works if you run it on a node that is part of a cluster.  I am trying to find what nodes are in the cluster from a node outside the cluster.

    Thursday, May 25, 2017 4:00 PM
  • You can always ask the cluster name :)

    Invoke-Command  {Get-ClusterNode} -computername ClusterName


    Thursday, May 25, 2017 6:21 PM
  • That also only works if you are running it on a node that is part of the cluster.

    Do you know why these two commands return different object values?

    get-cluster -domain  xxx.xxx.xxx | Where-Object {$_.Name -eq 'XYZCluster'}

    get-cluster NodeInCluster

    I can tell they are not returning the same value because we you pipe it to a Get-ClusterNode command, it does not behave the same when I expect it to.

    Thursday, May 25, 2017 8:01 PM
  • I tried this command from my workstation Win8.1 to a cluster in my company with Server 2012 R2 and it came back with all of the nodes, what is the error and what version are you running? 

    You have to query the cluster name, not the node name 

    Thursday, May 25, 2017 8:14 PM
  • You also need t have permissions on the cluster to query it.


    \_(ツ)_/

    Thursday, May 25, 2017 8:18 PM
  • All nodes are running Server 2012 R2 in Azure and are part of the same domain.

    get-cluster NodeinCluster works fine.

    PS C:\Users\cloudadmin> get-cluster -domain t003.local

    Name
    ----
    CL-T003SQL001


    PS C:\Users\cloudadmin> Invoke-Command  {Get-ClusterNode} -computername CL-T003SQL001
    [CL-T003SQL001] Connecting to remote server CL-T003SQL001 failed with the following error message : WinRM cannot
    complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the
    network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
    default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
    subnet. For more information, see the about_Remote_Troubleshooting Help topic.
        + CategoryInfo          : OpenError: (CL-T003SQL001:String) [], PSRemotingTransportException
        + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionStateBroken

    PS C:\Users\cloudadmin> get-clusternode -cluster CL-T003SQL001
    get-clusternode : Check the spelling of the cluster name. Otherwise, there might be a problem with your network. Make
    sure the cluster nodes are turned on and connected to the network or contact your network administrator.
        The RPC server is unavailable
    At line:1 char:1
    + get-clusternode -cluster CL-T003SQL001
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ConnectionError: (:) [Get-ClusterNode], ClusterCmdletException
        + FullyQualifiedErrorId : ClusterRpcConnection,Microsoft.FailoverClusters.PowerShell.GetNodeCommand

    PS C:\Users\cloudadmin> get-cluster VM-T003SQL001

    Name
    ----
    CL-T003SQL001



     
    Thursday, May 25, 2017 8:27 PM
  • Try this Invoke-Command  {Get-ClusterNode} -computername VM-T003SQL001
    Thursday, May 25, 2017 8:35 PM
  • That works but the requirement is to not know what nodes are present in the cluster.

    "I am trying to write a script to have a node add itself to a Windows Failover Cluster without knowing what other nodes are part of the cluster."

    As a node, I only know the cluster name and want to add myself to that cluster.

    • Edited by mtam_79 Thursday, May 25, 2017 10:12 PM
    Thursday, May 25, 2017 10:11 PM
  • Can you ping the cluster name? You need to verify that the cluster name is online and reachable 
    Friday, May 26, 2017 4:02 AM
  • Yes I can ping the cluster name, I know the cluster is online because I can run the same commands from a node within the cluster.

    Do you know why these two commands return different object values?

    get-cluster -domain  xxx.xxx.xxx | Where-Object {$_.Name -eq 'XYZCluster'}

    get-cluster NodeInCluster


    Friday, May 26, 2017 2:10 PM
  • Hi,

    >>Do you know why these two commands return different object values?

    Try: get-cluster NodeInCluster | gm

    And:get-cluster -domain  xxx.xxx.xxx | Where-Object {$_.Name -eq 'XYZCluster'} | gm

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, June 5, 2017 8:52 AM