Hi,
This post will discuss changing values of cluster objects using PowerShell in Windows Server 2008 R2. For resources and other components in a cluster, every cluster object has properties (common property). Parameters (private properties) are optional and a cluster object may or may not have them.
Using Cluster.exe you can get these values by executing:
Cluster.exe res /priv /prop
With PowerShell CMDlets, all the common properties are attached with the cluster object that CMDlet returns:
Get-ClusterResource “Cluster Name” | format-list *
The above CMDlet would display all the properties of the ClusterResource Object returned by Get-ClusterResource CMDlet. The format-list CMDlet can be shortened to fl.
The same data can be viewed different with different fomating CMDlets provided by PowerShell. By default we have provided some formatting where the execution of CMDLet would only display certain properties that the user cares the most about.
For example, when you execute the below CMDlet, by default the Resource Name, State, Group and Resource Type, but then the resource object contains more properties (common properties).
Get-ClusterResource "Cluster Name"
Name State Group ResourceType
---- ----- ----- ------------
Cluster Name Online Cluster Group Network Name
To see a complete list of properties and its value you can use Format-List command (to get help on Format-List, use Get-Help).
Get-ClusterResource “Cluster Name” | Format-List *
Cluster : MyCluster
IsCoreResource : True
IsNetworkClassResource : False
IsStorageClassResource : False
OwnerNode : MyCluster-node2
ResourceType : Network Name
State : Online
OwnerGroup : Cluster Group
Name : Cluster Name
MaintenanceMode : False
MonitorProcessId : 908
Description :
SeparateMonitor : False
PersistentState : 1
LooksAlivePollInterval : 4294967295
IsAlivePollInterval : 4294967295
RestartAction : 2
RestartThreshold : 1
RestartDelay : 500
RestartPeriod : 900000
RetryPeriodOnFailure : 3600000
PendingTimeout : 180000
DeadlockTimeout : 300000
ResourceSpecificStatus :
Id : f6a82193-559c-4af3-9d59-27b99b59ca07
The same data can be viewed differently by using Format-Custom CMDlet (please see Get-Help Format-Custom for more information on Format-Custom). Basically all the objects of the properties are expanded. For example, Cluster Group is an object of type ClusterGroup and contains more information like the node owning the group, and the state of the group. So when a Format-Custom CMDlet is executed, it gets expanded and you can see the values of those objects too.
Get-ClusterResource “Cluster Name” | Format-Custom *
class ClusterResource
{ Cluster =
class Cluster
{ Name = MyCluster }
IsCoreResource = True
IsNetworkClassResource = False
IsStorageClassResource = False
OwnerNode =
class ClusterNode
{ Name = MyCluster-node2
State = Up }
ResourceType =
class ClusterResourceType
{ Name = Network Name
DisplayName = Network Name }
State = Online
OwnerGroup =
class ClusterGroup
{ Name = Cluster Group
OwnerNode =
class ClusterNode
{ Name = MyCluster-node2
State = Up }
State = Online }
Name = Cluster Name
MaintenanceMode = False
MonitorProcessId = 908
Description =
SeparateMonitor = False
PersistentState = 1
LooksAlivePollInterval = 4294967295
IsAlivePollInterval = 4294967295
RestartAction = 2
RestartThreshold = 1
RestartDelay = 500
RestartPeriod = 900000
RetryPeriodOnFailure = 3600000
PendingTimeout = 180000
DeadlockTimeout = 300000
ResourceSpecificStatus =
Id = f6a82193-559c-4af3-9d59-27b99b59ca07 }
Modifying Common Properties
To modify the value of any of the above property you need to cache the object, and set the value. For example, let say you want to change the name of the resource:
Get-ClusterResource “<resource name>”| % { $_.Name=”<new name>”}
Over here we are using foreach , where as we know the above CMDlet would only return one resource and piping the object to foreach object would result in processing on exactly one resource.
Another way would be:
$res = Get-ClusterResource “<resource name>”
$res.Name=”<new name>”
Another way of doing this is:
( Get-ClusterResource “<resource name>” ).Name = “new name”
Keep in mind that some of the properties of the object are read only and cannot be modified.
Obtaining the Parameters
To get parameters (Private Properites) of a resource we use Get-ClusterParameter CMDlet:
Get-ClusterResource "Cluster Name" | Get-ClusterParameter
Object Name Value Type
------ ---- ----- ----
Cluster Name Name MyCluster String
Cluster Name DnsName MyCluster String