Powershell: disable/enable VMotion Port

For some strange reason, sometimes we cannot do a VMotion. While trying to resolve this strange issue, we did found a workaround: disable and enable the VMotion port. Once that's done, manual VMotion and VMotion triggered by DRS is working again. So I made a Powershell script to find the interface where VMotion is enabled, disable it and enable it again. Pretty straightforward, but I wanted to share it anyway.

 $vc = Connect-VIServer "<your vCenter here>"
$esxhosts = Get-VMHost
foreach ($esxhost in $esxhosts) {
 $vmHostNetwork = Get-VMHostNetwork -VMHost $esxhost
 $vmHostNetwork.VirtualNic | foreach {
 if ( $_.VMotionEnabled -eq "True" ) {
 Set-VMHostNetworkAdapter -VirtualNic $_ -VMotionEnabled $false -IP $_.IP -SubnetMask $_.SubnetMask
 Set-VMHostNetworkAdapter -VirtualNic $_ -VMotionEnabled $true -IP $_.IP -SubnetMask $_.SubnetMask

( 1 Vote ) 
Comments (4)
  • Essay reviews  - You have done a fabulous work.

    You have done a fabulous work. It is very beautiful. I will definitely watch this video. Thank you so much for sharing your ideas with us. You have a brilliant writing skill. Keep sharing such helpful post. I always love to read articles to improve my knowledge. I found this site as a good source of knowledge. Thank you for your articles. Essay writing service reviews to get reviews of various online writers.

  • Jan Caddigan  - Powershell: disable/enable VMotion Port

    As a Newbie, I am continuously exploring online for articles that can help me. Thank you

  • Hyman Polle  - Powershell: disable/enable VMotion Port

    The crux of your writing whilst sounding reasonable in the beginning, did not really sit very well with me after some time. Someplace throughout the sentences you actually were able to make me a believer unfortunately only for a very short while. I nevertheless have a problem with your jumps in logic and one might do well to fill in all those breaks. In the event that you actually can accomplish that, I would certainly end up being impressed.

  • Andres Obrecht  - Powershell: disable/enable VMotion Port

    "Best Blogpost! Hi there! This is my first comment here so I just wanted to give a quick shout out_ and tell you I genuinely enjoy reading through your posts. Can you recommend any other blogs/websites/forums that deal with the same topics?"

Write comment
Your Contact Details:
Gravatar enabled
[b] [i] [u] [s] [url] [quote] [code] [img]