You can get the cluster name from a VirtualMachineImpl object by $_.VMHost.Parent.Name. So you don't need the hashtable.
In the Get-VMInfo function the "$i=1" and "$j=1" lines should be before the foreach startement and not inside the loop.
You can get the cluster name from a VirtualMachineImpl object by $_.VMHost.Parent.Name. So you don't need the hashtable.
In the Get-VMInfo function the "$i=1" and "$j=1" lines should be before the foreach startement and not inside the loop.