It seems funny but possible, where using virtual vCenter and didn't created any VM-host affinity rule to limit its movement on hosts and in case if vCenter goes down then this script could be useful in locating it....
That's it... :)
If all hosts are having the same password, then,
#Script to find a VM from a pool of individual hosts having differ passwords
Add-PSSnapin VMware.VimAutomation.Core
$connectvmhost = "Connect-VIServer host-A -user root -password xyz"
$connectvmhost += "Connect-VIServer Host-B -user root -password 123xyz"
$connectvmhost
Get-VM vm-name -server Host-A, Host-B | select Name, VMhost
Disconnect-VIServer -Confirm:$false
I believe, there would be a better way to do this but this also serves the purpose.
$usr = 'user_name'
$pwd = 'password'
$connectvmhost = "Connect-VIServer host-A -user $usr -password $pwd"
$connectvmhost += "Connect-VIServer Host-B -user $usr -password $pwd"
$connectvmhost
Get-VM vm-name -server Host-A, Host-B | select Name, VMhost
Disconnect-VIServer -Confirm:$false
That's it... :)