Hi all,
I am trying to write a script to determine which VM cannot be vmotioned.
In our infrastructure some host are not configured with a vmkernel vmotion.
I guess how i can do that :
Trying something like that but without success :
$VmHost =Get-VMHost
Get-VM | Get-VMHostNetworkAdapter -VMHost $VmHost.Name -VMKernel | Where {$_.VMotionEnabled -eq “true”}
can someone help ?
You can do something like this
Extract the VMotionEnabled property on all VMKernel vnics, then test if there is no $true value between them
Get-VMHost |
where {(Get-VMHostNetworkAdapter -VMHost $_ -VMKernel | select -ExpandProperty VMotionEnabled) -notcontains $true} |
select Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks for your reply Lucd,
It's work but it get only the vmhostname,
Want to know if i can get vmname from vmhost with the same script,
Thanks for all
Sorry, I don't understand what you're asking here.
The vmk over which vMotion occurs is a VMHost object, nothing to do with VMs.
Unless you want to see a list of VMs on all the VMHosts where vMotion is not available ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
you want to see a list of VMs on all the VMHosts where vMotion is not available ?
That's it
Try like this
Get-VMHost |
where {(Get-VMHostNetworkAdapter -VMHost $_ -VMKernel | select -ExpandProperty VMotionEnabled) -notcontains $true} |
Get-VM |
Select Name,@{N='ESXi';E={$_.Host.Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference