Change Parameters of Windows Fail-Over Cluster with PowerShell

By | June 16, 2016

Configurations of a Windows Fail Over Cluster can be done entirely from the GUI but as we know this is valid for the simple setup. The GUI is limited to the easy cases, not for more uncommon cases. I already covered the case of the Active Directory Detached Cluster that can be created only using PowerShell command line, see https://blog.voina.org/deploy-windows-cluster-on-two-sites-with-only-one-domain-controller/
In case we want to change the already configured cluster again only some basic parameters can be changed from the GUI. Instead by using PowerShell we can virtually change any static parameter of the Cluster configuration.

To construct a script that can change any Cluster resource we have to follow the following steps. As an example I will change the static cluster IP.

STEP 1: Get a handle to the resource we want to change
This can be done by creating a PowerShell variable that holds a handle to the resource we want to change.

We can list the cluster resources by using the command:

The result is a table with a list of all resources:
Name — State — OwnerGroup — ResourceType

Now get a handle to of a resource in the shell variable $resource.

For example to get the handle of the cluster IP:

STEP 2: Display the changeable parameters of the resource

To display what parameters we can change in that resource we have the command:

The result is a table with the parameters of this resource and their values.

STEP 3: Create the new parameter object
To be able to change the parameters of a resource we have to create some new parameter objects and then later set them to the cluster.

For example lets change the “Address” and “SubnetMask” of the “Cluster IP Address” resource.

STEP 4: Stop the resource to be changed
To be able to change the parameters of a resource first we have to stop the resource, maybe is safe to stop the whole cluster also.
To stop the cluster IP resource execute:

Just to be safe stop the whole cluster if we are allowed to do it.

STEP 5: Set the new resource parameters
The last step is to commit the new resource parameters and check the result.
We have to send the new parameter objects to the Set-ClusterParameter command

To check the result:

Now start the resource :

In case the whole cluster was stopped start the cluster

Now to check if all the cluster resources are online and started:

Advertisements