This thread here shows you how to test vmotion compatibility to a specific host.
It’s a good starting point.
The return value are using the managed objet id's so you would need to convert them into the vm name if you don’t know them and are using a looping script.
## name of VM to check for VMotion compatibility
$strMyVMNameToCheck = "myVM0"
## name of destination VMHost to check for VMotion compatibility for this VM
$strMyVMHostNameToCheck = "myDestinationHost.mydomain.com"
## get the ServiceInstance object
$viewSI = Get-View 'ServiceInstance'
## get the VMProvisioningChecker object
$viewVmProvChecker = Get-View $viewSI.Content.VmProvisioningChecker
## query the VMotion Compatibility
$viewVmProvChecker.QueryVMotionCompatibilityEx((Get-VM $strMyVMNameToCheck).Id, (Get-VMHost $strMyVMHostNameToCheck).Id)
Pasted from <http://communities.vmware.com/message/2133414#2133414>
IN the pic the first vmotion test gave no error so vmotion is green light.
The second is giving some errors, as expected.
Here is some code to get the name of a vm from the vm's MOID
$vms = Get-VM
$vmidtofind="VirtualMachine-vm-25"
foreach($vm in $vms){
$test=get-vm $vm | %{$_.id}
if($test -eq $vmidtofind) {write-host "vmname is " $vm}
}
0 comments:
Post a Comment