Hyper-V PowerShell – Determine which NIC is being used for CSV communication

April 1, 2015 at 4:35 pm in Hyper-V, PowerShell by Wim Matthyssen

image On a regular base I need to help customers with problems or changes on their Hyper-V environment. In those cases the quickest and most flexible way to do a lot of admin tasks is by use of PowerShell. Yes, it really can make your life as an IT administrator easier! So in this series I will provide you with the PowerShell commands that I mostly use when working on or troubleshooting Hyper-V environments.

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. Keep in mind that it’s also the same network as for your cluster heartbeat. That’s why in part 1 of this series I will demonstrate, how you can quickly check which network is in use for this CSV communication. Secondly, I will explain how you can change that network manually.

1) First of all logon to a Hyper-V host and open up PowerShell with administrator permissions

2) Run the following command:

 Get-ClusterNetwork | ft Name, Metric, AutoMetric, Role 

image

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. Myself I always use a Metric of 900, because then I’m completely sure that’s the case.

3) So to change the Metric setting to 900 for the CSV network, type the following command:

 (Get-ClusterNetwork "networkname").Metric = 900 

Be aware that if you set the Metric yourself the AutoMetric setting will change from True to False.

4) In case you want the cluster to start automatically assigning the Metric setting again, you need to run the following command:

 (Get-ClusterNetwork "networkname").AutoMetric = $true 

This concludes my first part of the Hyper-V PowerShell series. Keep tuned and more will follow!

Wim Matthyssen (@wmatthyssen)

Share on LinkedInTweet about this on TwitterShare on Google+Share on Facebook