We can use this script to extract host details of the multiple clusters in one vmware datacenter. With this example im export required data to the text files

 

add-pssnapin vmware.vimautomation.core

Connect-VIServer 127.0.0.1

$arrclushost=Get-cluster -Location datacenter01  # I have one datacenter(Datacenter01) in my vmware enviorement

for ($inta=0 ; $inta -le ($arrclushost.Count)-1  ; $inta ++)

    {

    Add-Content d:\information\hostdetails.txt -Value $arrclushost[$inta].name

    $strhostdetails=Get-VMHost -Location $arrclushost[$inta].name | ft name,version,build |  Out-String

    Add-Content d:\information\hostdetails.txt -Value $strhostdetails

 }

Advertisements