VMware Cloud Community
lElOUCHE_79
Enthusiast
Enthusiast
Jump to solution

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

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é

Reply
0 Kudos