Unable To Connect To vCenter Server

Scenario: You’ve had a power outage, you start up your ESXi hosts, but can’t connect to the vCenter Server to manage your hosts and start up your VMs. You have a bunch of hosts and it’s taking ages connecting the vSphere Client to each one to see which host the vCenter Server is running on. You need this PowerCLI script to help you find which host the vCenter Server resides so you can troublshoot why you can’t connect to it:

$findvm = Read-Host -Prompt “ENTER VCENTER SERVER NAME”
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false
$esxservers = get-content “ENTER VCENTER SERVER IP ADDRESS”
Connect-VIServer -Server $esxservers
$vmlist = (Get-VM | select -expandproperty name)
foreach ($vm in $vmlist)
    {
    if ($vm -eq $findvm)
        { Write-Host “$findvm was located on $esxserver” exit }
    }
Write-Host “$findvm was not located on any host”

To use the script, ENTER VCENTER SERVER NAME and ENTER VCENTER SERVER IP ADDRESS in the script.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Leave a comment

Your email address will not be published. Required fields are marked *