VMware Cloud Community
bccigna
Enthusiast
Enthusiast
Jump to solution

Cluster Compare

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.

0 Kudos
1 Solution

Accepted Solutions
bccigna
Enthusiast
Enthusiast
Jump to solution

Figured it out. Needed to add Format-Table. $output += $myPGCol | Format-Table

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

I think your last lines are not correct, try like this

          ....

          }

          $output += $myPGCol

}

$output


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
bccigna
Enthusiast
Enthusiast
Jump to solution

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

0 Kudos
bccigna
Enthusiast
Enthusiast
Jump to solution

Figured it out. Needed to add Format-Table. $output += $myPGCol | Format-Table

0 Kudos