Get vm host and cluster Powercli

$Clusters = get-cluster
$Result [email protected](

Foreach ($Cluster in $Clusters)
{
$VMhosts = Get-VMHost -Location $Cluster
foreach($VMhost in $VMhosts)
{
[pscustomobject]@{

“Host” = $VMhost.Name
“Cluster Name” = $Cluster

}
}
}

)
$Result

About Meir Peleg 338 Articles
My name is Meir Peleg, (Born 30/04/1991) live in ISRAEL. Live and breath IT world. Microsoft MVP Windows IT & VMware vExpert.