lElOUCHE_79
Enthusiast
Enthusiast

Set MTU to All ESXi within a Cluster

I have the below Script to set the MTU to 9000

I need assistance to modify it in order to apply it only to specific cluster

 

$mtuSize = 9000

Get-VMHost | Get-VMHostNetworkAdapter -VMKernel |

where{$_.Mtu -ne $mtuSize} |

Set-VMHostNetworkAdapter -Mtu $mtuSize -Confirm:$false

0 Kudos
2 Replies
LucD
Leadership
Leadership

Try like this

$clusterName = 'cluster'
$mtuSize = 9000

Get-Cluster -Name $clusterName |
Get-VMHost | 
Get-VMHostNetworkAdapter -VMKernel |
where{$_.Mtu -ne $mtuSize} |
Set-VMHostNetworkAdapter -Mtu $mtuSize -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
a_p_
Leadership
Leadership

Please note that depending on what you want to achieve, you  may also need to set the MTU size on the vSwitches that the VMkernel adapters are connected to.

André

0 Kudos