On a regular base, I help customers with problems or changes on their Hyper-V environment(s). And of course, also with Hyper-V, the quickest and easiest way to perform many of those admin tasks is with the help of PowerShell. Yes, it really can make your life as an IT Administrator a lot easier!
As most Hyper-V admins will know, when you first built your Hyper-V failover cluster and enable Cluster Shared Volumes (CSV), the network used for CSV communication and storage I/O redirection is automatically chosen. However, you can designate this network by using the cluster network property, Metric.
The used CSV network is also the same network used for inter-node cluster communication (cluster heartbeat). Keep in mind that you should allow cluster network communication (enabled for “Cluster Communications”) on this network, and clear the Allow clients to connect trough this network check box, to get it working properly.
In this post, I will show you how you can use PowerShell to quickly check and change the network used for Clustered Shared Volumes (CSV) communication for your Hyper-V failover cluster.
You can find more information about using CSV in a failover cluster over here
Check network in use for CSV communication
Logon to a Hyper-V host (member of your failover cluster) and open up PowerShell with administrator permissions.
Run the following command:
Get-ClusterNetwork | ft Name, Metric, AutoMetric, Role
Change Metric value
The CSV communication network is always the network with the lowest Metric, in this case the network with name “ClusterInterconnect” and a Metric of 1000. The reason for this is when the cluster sets the Metric, it always uses increments of 1000 for private networks (networks without a default gateway set) like the CSV network. So if you want to set it yourself, like I prefer, be sure to use a number smaller then 1000 and also make it the lowest Metric value of all used networks. I always use a Metric of 900, because then I’m completely sure that’s the case.
To change the Metric setting to 900 for the CSV network, run the following command (adjust the “networkname” to your environment):
(Get-ClusterNetwork "networkname").Metric = 900
Be aware that if you set the Metric yourself the AutoMetric setting will change from True to False.
In case you want the cluster to start automatically assigning the Metric setting again, you need to run the following command (adjust the “networkname” to your environment):
(Get-ClusterNetwork "networkname").AutoMetric = $true
Hope these PowerShell commands come in handy!