PowerShell for Failover Clustering: Find Clusters in a Domain

Hi Cluster Fans,

 

Using PowerShell in Windows Server 2008 R2 Failover Clustering we have made it very easy to find all the clusters within a domain.

 

You may already know that you can use the Get-Cluster CMDlet to get information about the current cluster you are working on.  Beyond this, Get-Cluster also gives you the ability to find other clusters in your domain.

 

To find all the parameters, details and even examples of every CMDlet, you can run Get-Help CMDlet –Full

 

Let’s check out the output for the Get-Cluster parameter:

 

PS C:\Windows\system32> Get-Help Get-Cluster -Full

 

NAME

    Get-Cluster

 

SYNOPSIS

    Get information about one or more failover clusters in a given domain.

 

SYNTAX

    Get-Cluster [-Domain <string>] [<CommonParameters>]

    Get-Cluster [[-Name] <string>] [<CommonParameters>]

 

DESCRIPTION

    This cmdlet can obtain a variety of configuration and state information about a failover cluster, including the following items:

    – State information about whether a backup is in progress.

    – State information about whether the cluster is in a forced quorum state.

    – Cross-network settings that are especially relevant for multi-site clusters.

    To set a common property for the cluster, use this cmdlet to get the cluster object and then set the appropriate property on that cluster object directly.

 

PARAMETERS

    -Domain <string>

        Specifies the name of the domain to enumerate clusters in.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?  false

 

    -Name <string>

        Specifies the name of the cluster to get.

        Required?                    false

        Position?                    1

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?  false

 

    <CommonParameters>

        This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, “get-help about_commonparameters”.

 

INPUTS

 

OUTPUTS

    Microsoft.FailoverClusters.PowerShell.Cluster

 

NOTES

 

    ————————– EXAMPLE 1 ————————–

 

    C:\PS>Get-Cluster | fl *

 

    Domain                           : contoso.com

    Name                             : cluster1

    FixQuorum                        : 0

    SharedVolumesRoot                : C:\ClusterStorage

    DefaultNetworkRole               : 2

    Description                      :

    QuorumArbitrationTimeMax         : 20

    ClusSvcHangTimeout               : 60

    ClusSvcRegroupStageTimeout       : 7

    ClusSvcRegroupOpeningTimeout     : 5

    ClusSvcRegroupPruningTimeout     : 5

    ClusSvcRegroupTickInMilliseconds : 300

    HangRecoveryAction               : 3

    SameSubnetDelay                  : 1000

    CrossSubnetDelay                 : 1000

    SameSubnetThreshold              : 5

    PlumbAllCrossSubnetRoutes        : 0

    CrossSubnetThreshold             : 5

    BackupInProgress                 : 0

    RequestReplyTimeout              : 60

    WitnessRestartInterval           : 15

    SecurityLevel                    : 1

    ClusterLogLevel                  : 3

    ClusterLogSize                   : 100

    WitnessDatabaseWriteTimeout      : 300

    AddEvictDelay                    : 60

    EnableSharedVolumes              : Enabled

    Id                               : 655d3640-2845-4077-a396-9f317f2df60e

 

    Description

    ———–

    This command displays state and property information for the local cluster in the form of a list.

 

 

    ————————– EXAMPLE 2 ————————–

 

    C:\PS>Get-Cluster cluster1

 

    Name

    —-

    cluster1

 

    Description

    ———–

    This command gets information about a cluster named cluster1.

 

 

    ————————– EXAMPLE 3 ————————–

 

    C:\PS>Get-Cluster -domain contoso.com

 

    Name

    —-

    cluster1

    cluster2

    cluster3

 

    Description

    ———–

    This command gets information about each of the clusters in the contoso.com domain.

 

 

    ————————– EXAMPLE 4 ————————–

 

    C:\PS>$cluster = Get-Cluster; $cluster.CrossSubnetDelay = 1500

 

    Description

    ———–

    This command sets the common property CrossSubnetDelay for the local cluster to 1500. Alternatively, you can run “Get-Cluster | %{ $_.CrossSubnetDelay = 1500 }” to set that property.

 

RELATED LINKS

    Online version: http://go.microsoft.com/fwlink/?LinkId=143782

    New-Cluster

    Remove-Cluster

    Start-Cluster

    Stop-Cluster

    Test-Cluster

 

 

As we can see from the third example, we already have the information we need to query all clusters in a domain!  We recommend checking out the help examples for the CMDlets if you want to figure out common operations for each.

 

Simply run Get-Cluster –domain MyDomain.com and you will get the list of clusters in that domain.

 

Don’t forget that you can also view this same help content online by using the –online switch: Get-Help Get-Cluster –online

 

Thanks,

Symon Perriman
Program Manager II
Clustering & High-Availability

Microsoft