For various reasons I have inherited a mixed VSphere 4 and vSphere 5.1 estate with PowerCli 5.1 Release 2
As part of our daily checks, due to the departure of our VM Admin, I have been asked to create a report that shows all ESXi hosts from all 4 vcenter servers (2 are dedicated to the vSphere 4 environment, 2 are dedicated to the separate vSphere 5 environment) with the following output:
ESXi hostname, AnnotationEntity, ConnectionState, PowerState, DVS Status
So far, after connection to all 4 vCenter Servers, I can get ESXi hostname & Annotation via
Get-VMHost | Get-Annotation | Select, AnnotatedEntity, Value
and I can get ConnectionState and PowerState via
Get-VMHost | Select Name,ConnectionState,PowerState
but I am lost as to
a) How to get DVS Status (as seen when selecting the Distributed Switch and clicking the hosts tab) and
b) How to get this all, if possible, in one output either as output to screen or to a tabbed / csv file in the format
ESXi hostname, AnnotationEntity, ConnectionState, PowerState, DVS Status (order is not important as long as ESXi Hostname is the first column).
I'm sure this is a (relatively) simple script but would appreciate any advice as I have to get up to speed reasonably quickly so hoping someone out there is able to help / advise.
Many thanks,
Chris