Hello
I am looking for powershell script that will run across multiple virtual centers and gather info about esx hosts current state with script out that will poduce esxi host name, state (maintenance mode,disconnected,not-responding), cluster name and virtual center in cvs format.
I am running PS 5.1 and learning how to.
Thanks for assistance.
Something like this?
foreach($vc in $global:DefaultVIServers){
Get-Cluster -Server $vc -PipelineVariable cluster |
Get-VMHost -Server $vc |
Select @{N='vCenter';E={$vc.Name}},@{N='Cluster';E={$cluster.Name}},Name,State
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
For some reason when I connect to multiple vcenters and started your script ( that I will need to produce esxi host name, state (maintenance mode,disconnected,not-responding), cluster name and virtual center in cvs format) I got report from only first connected vcenter and script complete and also script out did no save out info in csv format.
can you help me here to complete task?
Thank You very much
Can you check with Get-PowerCLIConfiguration how the DefaultVIServerMode is configured?
It should say 'Multiple' to allow parallel vCenter connections.
If not, change it with
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
I set mode as you suggested and still is giving me output from only first connected vcenter to then script stopped
execution policy is also set to remotesigned
When you connected to all the vCenters, what is in $global:DefaultVIServers
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference