I'm working on a script that will loop through the clusters in a vCenter and perform a compare of the portgroups and report on inconsistencies. I'm having problems getting the script loop through all clusters in the vCenter. It will perform the check on the first cluster and then stop. If anyone has any ideas on how to fix it, or a better way of performing the check please let me know.
Script is attached.
Figured it out. Needed to add Format-Table. $output += $myPGCol | Format-Table
I think your last lines are not correct, try like this
....
}
$output += $myPGCol
}
$output
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Luc,
Yep... I tried that way too. It displays the cluster and portgroups, but will not show the host info past the first cluster.
For Instance...
Cluster PortGroup Host1 Host2
--------- ----------- ------------ ------------
Cluster-A PortGroup-A True False
Cluster-B PortGroup-A
Cluster-C PortGroup-A
Cluster-D PortGroup-A
The Format I'm looking for is something like this.
Cluster PortGroup Host1 Host2
--------- ----------- ------------ ------------
Cluster-A PortGroup-A True False
Cluster PortGroup Host1 Host2
--------- ----------- ------------ ------------
Cluster-B PortGroup-A True False
Figured it out. Needed to add Format-Table. $output += $myPGCol | Format-Table