With a few PowerShell commands, you can efficiently find all the Hyper-V nodes available in a Hyper-V cluster,...
and with a PowerShell script, you can easily save that data as a readable file.
PowerShell is becoming the first choice for IT administrators to perform command-line operations. With PowerShell, you can automatically create a Hyper-V cluster and deploy a VM. Microsoft provides full PowerShell support for Windows failover clusters, including cmdlets you can use to manage a Hyper-V cluster. There are a bunch of cmdlets available to use with Hyper-V clusters, but the focus of this article is on finding Hyper-V cluster nodes.
You can use the Get-ClusterNode PowerShell cmdlet to find all Hyper-V nodes in a Hyper-V cluster. Below are some examples that use the Get-ClusterNode cmdlet.
Type Get-ClusterNode to list all the Hyper-V nodes available in a Hyper-V cluster.
The command to the left targets the current Hyper-V cluster and shows the list of available Hyper-V nodes with an Up status. If you want to get available Hyper-V nodes from a specific cluster, use the -Cluster parameter, as shown below.
Get-ClusterNode –Cluster HyperVPRODCluster
If you have more than one Hyper-V cluster, you can create a text file that contains the Hyper-V cluster names and then execute a PowerShell script that collects the results and saves them in a C:\Temp\ClustNodes.CSV file.
The script to the left gets each cluster name from the C:\Temp\ClusterNames.TXT file, executes the Get-ClusterNode command against each cluster and then saves the output in a C:\Temp\ClustNodes.CSV file.
Apart from including the node name hosted in a cluster, the result also shows the statuses of the Hyper-V nodes, as indicated in the third column of Figure C to the left.
Dig Deeper on Microsoft Hyper-V and Virtual Server
Related Q&A from Nirmal Sharma
Use System Center Virtual Machine Manager and PowerShell to make logical network management easy. Execute a script to display network virtualization ... Continue Reading
Hyper-V replication is easy to use, but there are a number of steps you should take during Hyper-V replication setup to ensure you stay abreast of ... Continue Reading
There isn't a set number of virtual processors you should configure for a Hyper-V VM, but there are steps you can take to ensure your workloads ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.