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... :)
#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:$falseIf all hosts are having the same password, then,
$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:$falseI believe, there would be a better way to do this but this also serves the purpose.
That's it... :)
No comments:
Post a Comment