Archives


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.

Google BookmarksEmailHyvesStumbleUponLinkedInShare

Related posts:

  1. Creating portgroups with PowerShell
  2. Upgrading VMware ESX 3.5 to ESX 4.0 (vSphere)
  3. vSphere 4 Update 1 released

Tags: ,

About

Anne Jan Elsinga is a Consultant for Imtech ICT in the Netherlands. He spends his working hours with a lot of virtualization stuff, from feasibility to implementation for server virtualization/consolidation and desktop virtualization. In 2009, 2010 and 2011 he was awarded with the VMware vExpert status. In the night time he dances latin, ballroom and salsa and he also discovered the pleasure of diving.

Comments are closed.