VMware Cloud Community
Henrique_Cicuto
Enthusiast
Enthusiast

How to discover in which host a VM is running (without vCenter)

Morning,

I had a problem (so far not diagnosed) in which now my vCenter is down.

The vCenter is a virtual machine.

I have over 50 hosts (don´t know all their names and IPs), all ESXi 4.1, and I´d like to know if there´s anyway I can discover in which one of them is my vCenter VM without having to log into each one of them.

0 Kudos
4 Replies
weinstein5
Immortal
Immortal

You will need to access each one idvidually whether through the vSphere client or console to see what VMs are running on the host -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
nava_thulasi39

Hi,

Additionally if you have vMA or Powercli, it's easy to search the VMs which is running by each & every ESXi Server.

Again It can be done searching every ESXi server.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
chriswahl
Virtuoso
Virtuoso

If you can dump a list of your hostnames to a txt file, this script will search for your VM.

$vmsearchname is the name of the VM you are looking for

$esxhosts points to the txt file with the host names. It should be in the format of

name

Hostname1

Hostname2

Hostname3

$rootaccess provides the root password

$vmsearchname = "vCenter5"
[array]$esxhosts = Import-Csv c:\hosts.txt 
$rootaccess = Get-Credential -Credential root

foreach ($esxhost in $esxhosts)
    {
    Connect-VIServer -Server $esxhost.name -Credential $rootaccess
    Get-VM | %{If ($_.name -match $vmsearchname) {Write-Host "Found $($_.name) on $($esxhost.name)"}}
    }
VCDX #104 (DCV, NV) ஃ WahlNetwork.com ஃ @ChrisWahl ஃ Author, Networking for VMware Administrators
0 Kudos
venkatfuture
Enthusiast
Enthusiast

Hi Chriswahl00,

Excellent....

0 Kudos