Powershell: disable/enable VMotion Port Print
Thursday, 15 July 2010 09:22

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
 } 
 }
}

Comments (0)
Write comment
Your Contact Details:
Gravatar enabled
Comment:

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."