Searching for a VM

One of the problems that most people have with virtualizing vCenter is that they don’t know where the vCenter VM is when there are problems.

There’s a fairly easy way to counter this problem.

WIth a couple of PowerShell lines you can check all ESX hosts individual for the existance of the vCenter VM, in this case the S-VC.

One of the minor issues is that you have to logon to each server. With some more lines of code you can even circumvent that.

Here’s the code:

$searchservers = @(‘host1′,’host2′,’host3’)

$SearchVM=’S-VC’

foreach ($vmhost in $searchservers)
{
connect-viserver $vmhost > out-null
if (get-vm | where {$_.Name -eq $SearchVM})
{
write-host $SearchVM ” found on host ” $vmhost
}
}

For this to work you need access to your ESX hosts from the network with the computer that’s running the script. You also need the VI Toolkit.

Related posts

Goodbye San Francisco, aquí vamos a Barcelona

by Erik Scholten
11 years ago

VMware View 5 available NOW

by Erik Scholten
12 years ago

RES PowerFuse 2010 released

by Edwin Weijdema
14 years ago
Exit mobile version