powercli script to extract hosts names in multiple esxi cluster/s

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


$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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.