Compartir a través de


ClusResDependencies.AddItem method

[The AddItem method is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Adds an existing cluster resource to the dependency collection.

Syntax

ClusResDependencies.AddItem( _
  ByVal objResource _
)

Parameters

objResource

The ClusResource object to add to the collection.

Return value

This method does not return a value.

Remarks

Resources added to a ClusResDependencies collection become dependencies of the resource from which the collection was obtained

Examples

The following script uses the AddItem method to add a dependency to a resource.

'''''''''''''''''''''''''''''''''''
' adddependency.vbs
' Adds a dependency to a resource. Both resources must already exist
' and be able to form a dependency relationship. Run the script on 
' the command line using the following syntax:
'     AddDependency Resourcename Dependencyname
' The resource identified by Resourcename will depend on the resource
' identified by Dependencyname.
''''''''''''''''''''''''''''''''''' 
Option Explicit
Dim objArgs, objCluster, objResource, objDependency
Set objArgs = WScript.Arguments
If objArgs.Count <> 2 Then
    WScript.Echo "Syntax:   AddDependency Resourcename Dependencyname"
    WScript.Quit
End If
Set objCluster = CreateObject("MSCluster.Cluster")
objClus.Open ""
Set objResource = objCluster.Resources.Item(objArgs(0))
Set objDependency = objCluster.Resources.Item(objArgs(1))
If objResource.CanResourceBeDependent(objDependency) Then
    objResource.Dependencies.AddItem(objDependency)
Else
    WScript.Echo objResource.Name & " cannot depend on " & objDependency.Name
End If
Set objResource = Nothing
Set objDependency = Nothing
Set objCluster = Nothing

Requirements

Minimum supported client
None supported
Minimum supported server
Windows Server 2008 Enterprise, Windows Server 2008 Datacenter
Header
MsClus.h
IDL
MsClus.idl
Type library
MsClus.tlb
DLL
MsClus.dll
IID
IID_ISClusResDependencies is defined as F2E60704-2631-11D1-89F1-00A0C90D061E

See also

ClusResDependencies

ClusResource