PowerShell for Failover Clustering: Frequently Asked Questions & Enabling CSV
Published Mar 15 2019 01:38 PM 1,145 Views
First published on MSDN on May 23, 2009


Today I’m going to talk a little more about PowerShell by answering some of the frequently asked questions I hear.

1)      Why is PowerShell better?

2)      How do I get started using PowerShell?

3)      Where are the properties?

4)      Where are the private properties?

5)      How do I enable CSV?

1)   Why is PowerShell better?

To get you excited I will talk about some cool stuff in our cmdlets.  When you compare the functionality to that of Cluster.exe you will see that PowerShell is much better.  All the pointers below could be topic in themselves, so for now I am not getting into details.

1)      Failover Cluster Manager has been liked by many users, and the best part of cluster administrator is its simplicity of use, including wizards which walk you through many common operations.

However our cmdlets do not show any GUI or wizards, they are purely CLI and scriptable.

What is my point?  Well we have tried to provide the Failover Cluster Manager type of experience in PowerShell.  For now, I would leave this for you to discover what I am talking about :)

2)      Running Validation.  Using PowerShell cmdlets you can run the “Validate a Configuration…” wizard on a clusters or unclustered nodes.  This even gives you the ability to run validation directly on Core installations.

3)      We have many cmdlets to manage VMs, including live migration. Yes, I am talking about writing PowerShell ccripts to live migrate VMs.  How cool is it to have a script which runs every few seconds or minute to monitor the cluster and its health, and based on some conditions re-balance the resources by live migrating VMs to different nodes.

4)      If I am talking about VMs, I do need to mention CSV.  I have already talked about how to enable CSV in PowerShell, but apart from that we do have a set of cmdlets to manage CSV disks.

5)      Creating roles have been simplified through PowerShell cmdlets.  For this release we have one line cmdlet to create roles (look at the Add-Cluster*role cmdlets).

6)      We also have exposed a cmdlet to generate dependency report that can be saved.  This allows you to render dependency reports directly on Core installations.

2)   How do I get started using PowerShell?

I guess this might not be new to some of you, but I want to make sure that I have it in this article, so that you do not have to search for it.  There are two ways to enable PowerShell.

1)      In the Windows Server 2008 R2 Release Candidate (RC) build and later, there will be a ‘Windows PowerShell Modules’ link under your Administrative Tools which will automatically import all the PowerShell modules for features or roles which you have installed.  It even runs it as an Administrator for you by default, so you don’t need to elevate the permissions every time.

You can then immediately start using Failover Clustering (or Network Load Balancing NLB) PowerShell cmdlets in the command prompt.

The RC build is available here: http://technet.microsoft.com/en-us/dd362341.aspx

2)      To be able to use PowerShell cmdlet's you need to run PowerShell in Administrative Mode and run below cmdlet

Import-Module FailoverClusters

My suggestion would also be to create a default profile for yourself and have this line added, so that the module gets loaded every time you open a PowerShell Windows.  In Windows Server 2008 R2, you do have the option to open a PowerShell Window and import all the modules on the machine.

Please note that modules are loaded in a session and will only remain while the session exists.

I have always found the output of the below command helpful.  This makes a table of cmdlets with cluster cmdlet name and a synopsis/description.  The description is pulled from the Help content of the cmdlet.

Feel free to modify this simple cmdlet to extract the information that you would need:

Get-Command -Module FailoverClusters | %{Get-Help $_.Name} | ft Name,Synopsis –Wrap

For Network Load Balancing, use NetworkLoadBalancingClusters

3)   Where are the properties?

The cluster objects are: cluster node, cluster group, cluster resource, cluster network, cluster network interface, resource types and the cluster, itself.  As I mentioned earlier our cmdlets are action oriented and you would be performing these actions on any of the above listed cluster objects.  Most of the cmdlets expect to return a cluster object back.

These objects are the container of their own properties.

So for example, let say you want to see the property of a resource. Using cluster.exe you would type:

Cluster.exe res <Resource Name> /prop

To get the same data from Cluster PowerShell cmdlets you would

Get-ClusterResource <Resource Name> | Format-List *

Get-ClusterResource returns a ClusterResource object.  This object contains all the pre-defined properties of the resource.  But if you just type

Get-ClusterResource <Resource Name>

You would only see some selected information about the resource on the output screen like resource name, resource group, resource state and resource type.   Also keep in mind the object that the cmdlet returns contains additional information which is hidden by default.

When you pipe the out of Get-ClusterResource to Format-List , the Format-List cmdlet takes the object and displays it as a list.  The second parameter to Format-List cmdlet '*' will show all values, thus you get to see all the properties of the ClusterResource object as a table of Property Name and Value.  You may also type ‘fl’ instead of ‘Format-List’.

So how do you modify the Value of these properties?

There are various ways to do this. You can either cache the object, access the property name and set new value for the property, or you can do the same thing on the fly, without caching it.

For example Let say you want to change the RestartDelay property of a resource.  You would use:

$res = Get-ClusterResource  <resource Name>

$res.RestartDelay=<new value>

And you are done.

You can present a counter argument that I can do the same with Cluster.exe and it is as simple as:

Cluster.exe res <resource name> /prop <propertyname>=<value>

I agree with you.  But how easy is it to do this for all the resource on your cluster?  The power of PowerShell helps us here. The below example would update a property of all the resource

Get-ClusterResource | For-Each { $_.<PropertyName>=<NewValue>}

What if you only wanted to change the value of property for specific resource type and not on all resource?

Yes, PowerShell does provide you with filtering options and you would be writing something like:

Get-ClusterResource | where-object { $_.ResourceType -ilike "<resourcetype" } | for-each { $_.<Property Name>=<value>}

Isn't that neat and simple?  This is where you get the power of PowerShell with its rich language (both cmdlet’ing and scripting).

4)   Where are the private properties?

Private properties?  Well for now we would use cluster parameters to refer private properties.  Let’s not get into the discussion of why they’re called cluster parameters and why not private properties.  We’ll leave that for another blog :).

One of the unusual things about cluster parameters is that they are dynamic.  The properties can be added or removed.  Another challenge is with the data type of these properties and the way cluster keeps this information.

For now, let’s focus on Get-ClusterParameter and Set-ClusterParameter.  Get-ClusterParameter is equivalent to /priv parameter in Cluster.exe

If you are interested in looking at the parameters of a resource, you use

Get-ClusterResource <resource name>| Get-ClusterParameter

The above cmdlet would list all the parameters of the given resource.

To Change the value of a parameter, enter

Get-ClusterResource <resource name> | Set-ClusterParameter -Name <parameter name> -Value <new value>

5)   How do I enable CSV?

We do not have any cmdlets which enable Cluster Shared Volumes (CSV).  Please do not misunderstand me, I am not saying that we cannot enable CSV feature from PowerShell.

Cluster objects have a property that controls enabling and disabling of CSV.  In Failover Cluster Manager there is actually no way to disable CSV.

To enable CSV on a cluster using PowerShell cmdlets, use

$clus = Get-Cluster <cluster name>


The above cmdlet would not enable the CSV feature, but rather it should show you the terms and restrictions associated with using CSV.  You will want to read these terms to better understand how and when CSV should be used.

For other CSV-related cmdlets, try

Get-Command -CommandType cmdlet *ClusterSharedVolume

Vikas Kumar
Software Development Engineer in Test
Clustering & High Availability


Version history
Last update:
‎Mar 15 2019 01:38 PM
Updated by: