Skip to content

ClusterPreferredOwner

dscbot edited this page Jun 11, 2022 · 2 revisions

ClusterPreferredOwner

Parameters

Parameter Attribute DataType Description Allowed Values
ClusterGroup Key String Name of the cluster group.
ClusterName Key String Name of the cluster.
Nodes Required StringArray[] The nodes to set as owners.
ClusterResources Write StringArray[] The resources to set preferred owners on.
Ensure Write String If the preferred owners should be present or absent. Default value is 'Present'. Present, Absent

Description

Configures preferred owners of a cluster group and cluster resources in a failover cluster.

Requirements

  • Target machine must be running Windows Server 2008 R2 or later.

Examples

Example 1

This example shows how to add two preferred owners to a failover cluster group and cluster resources in the failover cluster.

.NOTES This example assumes the failover cluster is already present.

Configuration ClusterPreferredOwner_AddPreferredOwnerConfig
{
    Import-DscResource -ModuleName FailoverClusterDsc

    Node localhost
    {
        ClusterPreferredOwner 'AddOwnersForClusterGroup1'
        {
            Ensure           = 'Present'
            ClusterName      = 'TESTCLU1'
            ClusterGroup     = 'Cluster Group 1'
            Nodes            = @('Node1', 'Node2')
            ClusterResources = @('Resource1', 'Resource2')
        }

        ClusterPreferredOwner 'AddOwnersForClusterGroup2'
        {
            Ensure           = 'Present'
            ClusterName      = 'TESTCLU1'
            ClusterGroup     = 'Cluster Group 2'
            Nodes            = @('Node1', 'Node2')
            ClusterResources = @('Resource3', 'Resource4')
        }
    }
}

Example 2

This example shows how to remove two preferred owners from a failover cluster group and cluster resources in the failover cluster. This will leave any preferred owners not specified in the configuration.

.NOTES If there are three preferred owners; Node1, Node2, Node3. This examples will still leave Node3 as a preferred owner.

This example assumes the failover cluster is already present, and the cluster groups and cluster resources are present.

Configuration ClusterPreferredOwner_RemovePreferredOwnerConfig
{
    Import-DscResource -ModuleName FailoverClusterDsc

    Node localhost
    {
        ClusterPreferredOwner 'RemoveOwnersForClusterGroup1'
        {
            Ensure           = 'Absent'
            ClusterName      = 'TESTCLU1'
            ClusterGroup     = 'Cluster Group 1'
            Nodes            = @('Node1', 'Node2')
            ClusterResources = @('Resource1', 'Resource2')
        }

        ClusterPreferredOwner 'RemoveOwnersForClusterGroup2'
        {
            Ensure           = 'Absent'
            ClusterName      = 'TESTCLU1'
            ClusterGroup     = 'Cluster Group 2'
            Nodes            = @('Node1', 'Node2')
            ClusterResources = @('Resource3', 'Resource4')
        }
    }
}