Set a cluster resource dependency
Set a cluster resource dependency

This script set a cluster resource dependency on a file server clustered resource

Script :

Get-Cluster -Name ClusterName |`
Get-ClusterResource -Name "FileServer-(FileserverResourceHostname)(Cluster Disk 10)" |`
Set-ClusterResourceDependency -Dependency ["FileserverResourceHostname"][and ["Cluster Disk 10"]]


Reference (http://technet.microsoft.com/en-us/library/ee461029.aspx)

Set-ClusterResourceDependency

Specify the resources that a particular resource depends on within a failover cluster. Existing dependencies will be overwritten by the dependencies that you specify.

Syntax 

Set-ClusterResourceDependency [-InputObject ] [[-Resource] ] [[-Dependency] ] [-Cluster ] []
  • InputObject
  • Resource
  • Dependency
  • Cluster

Detailed Description

You can use “or” in the expression describing the dependency. An example for using “or”: you can set up a dependency where a Network Name resource is dependent on either of two IP Address resources (instead of being dependent on both). This use of “or” dependencies is common in multi-site cluster deployments.

Parameters

Cluster

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.

Default Value:

Data Type: string

Attributes

 

Name Value PSMAML Attribute
Required? false required
Variable Length? false variableLength
Accept wildcard characters? false globbing
Accept Pipeline Input? false pipelineInput
Position? named position

Value Attributes

 

Name Value PSMAML Attribute
Required? true required
Variable Length? false variableLength

Dependency

Specifies the dependency expression to set for this resource. The format for this is string is “[Resource Name 1] [and|or [Resource Name 2] […] ]”. Resource names should be enclosed in square brackets as [Cluster Disk 2]. Refer to the examples. To reset the resource dependency use an empty string “” in this parameter.

Default Value:

Data Type: string

Attributes

 

Name Value PSMAML Attribute
Required? false required
Variable Length? false variableLength
Accept wildcard characters? false globbing
Accept Pipeline Input? false pipelineInput
Position? 2 position

Value Attributes

 

Name Value PSMAML Attribute
Required? true required
Variable Length? false variableLength

InputObject

Specifies the cluster resource to set the dependency expression for.

Default Value:

Data Type: psobject

Attributes

 

Name Value PSMAML Attribute
Required? false required
Variable Length? false variableLength
Accept wildcard characters? false globbing
Accept Pipeline Input? true (ByValue) pipelineInput
Position? named position

Value Attributes

 

Name Value PSMAML Attribute
Required? true required
Variable Length? false variableLength

Resource

Specifies the name of the cluster resource to set the dependency expression for.

Default Value:

Data Type: string

Attributes

 

Name Value PSMAML Attribute
Required? false required
Variable Length? false variableLength
Accept wildcard characters? false globbing
Accept Pipeline Input? false pipelineInput
Position? 1 position

Value Attributes

 

Name Value PSMAML Attribute
Required? true required
Variable Length? false variableLength

Input Type

Microsoft.FailoverClusters.PowerShell.ClusterResource

 

Return Type

 

Examples

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

Set-ClusterResourceDependency cluster1FS12 "[IP Address 151.56.48.0]"

Description

———–

This command makes the resource called cluster1FS12 dependent on [IP Address 151.56.48.0].

 

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

 
Set-ClusterResourceDependency cluster1FS12 "[IP Address 151.56.48.0] or [New IP Address]"

Description

———–

This command makes the resource called cluster1FS12 dependent on either [IP Address 151.56.48.0] or [New IP Address].

 

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

 
Set-ClusterResourceDependency cluster1FS12 ""

Description

———–

This command clears the dependency list for the resource cluster1FS12, so that it no longer depends on any other resources.

Set a cluster resource dependency

Leave a Reply

Your email address will not be published. Required fields are marked *