Here is a quick and easy few ways to get all the virtual machines in your failover cluster. We will use the Get-VM Powershell command to accomplish this with a couple switches depending on your desired output.  

 

1. Get all Virtual Machines in a Failover Cluster.

$clusterNodes = Get-ClusterNode;
ForEach($item in $clusterNodes) {Get-VM -ComputerName $item.Name}

 

2. Get all Running Virtual Machines in a Failover Cluster.

$clusterNodes = Get-ClusterNode;
ForEach($item in $clusterNodes) {Get-VM -ComputerName $item.Name | where state -eq 'Running'}

 

3. Output the list to a file you can simply pipe either of these for example.

$clusterNodes = Get-ClusterNode;
$GetOutput = ForEach($item in $clusterNodes) {Get-VM -ComputerName $item.Name | where state -eq 'Running'}
$GetOutput | Export-CSV C:\TEMP\RunningVMs.csv

Note: the Export to CSV will take some time to run if you do not do more formatting.