VMware Cloud Community
bernz
Enthusiast
Enthusiast
Jump to solution

How to extract vSphere Host HA state per cluster and export to CSV?

All

Anyone can help me creating script to extract and do check of all vSphere Host HA state per cluster.

Sample output:

Cluster Name     Host                    HA State

Cluster1             esx1.dom.com      Connected (Slave)

Cluster1             esx2.dom.com      Unreachable   

Sample HA State:

Connected (Slave)

Running (Master)

Unreachable

N/A

Regards,

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Cluster -PipelineVariable cluster |

Get-VMHost |

Select @{N='Cluster';E={$cluster.Name}},Name,@{N='State';E={$_.ExtensionData.Runtime.DasHostState.State}} |

Export-Csv .\report.csv -NoTypeInformation -UseCulture


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

View solution in original post

3 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Cluster -PipelineVariable cluster |

Get-VMHost |

Select @{N='Cluster';E={$cluster.Name}},Name,@{N='State';E={$_.ExtensionData.Runtime.DasHostState.State}} |

Export-Csv .\report.csv -NoTypeInformation -UseCulture


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

bernz
Enthusiast
Enthusiast
Jump to solution

Appreciated your help again Lucd, will give it a try and let your know 😃

Reply
0 Kudos
bernz
Enthusiast
Enthusiast
Jump to solution

Appreciated your script LucD!

It worked!

Reply
0 Kudos