How to find a VM in multiple vCenter using powercli.
I tried :
$vCenters = @("xx""xx")
ForEach-Object ($vCenter -in $vCenters)
{
$Connect = Connect-VIServer $vCenter -User xxxxx -Password xxxxx
}
No, if you set the mode to Multiple, it will automatically search in all connected vCenters.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you check that the DefaultVIServerMode is set to Multiple?
And with $global:defaultviservers you can check to which vCenters you are connected.
$vCenters = 'vc1','vc2'
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false
Connect-VIServer -Server $vCenters -User xxxxx -Password xxxxx
$global:DefaultVIServers
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks lucd
and for searching vms in multiple vcenter do i need to do as below ???
ForEach-Object ($vCenter -in $vCenters)
{
Get-VM -Name $VmName -Server $vCenters
}
No, if you set the mode to Multiple, it will automatically search in all connected vCenters.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference