Optimize NFS settings for Celerra

In continuation to both Jason Boche's and Scott Lowe's excellent posts about the recommended Advanced Settings for ESX while using a Celerra NFS mount, and after Jase McCarty's post earlier regarding how to set the recommended settings for ESX and NetApp, I wanted to share with you my script for doing the same for those who are using EMC

function optimize-CelerraNFS {
Set-VMHostAdvancedConfiguration -Name NFS.SendBufferSize -Value 64
Set-VMHostAdvancedConfiguration -Name NFS.ReceiveBufferSize -Value 64
Set-VMHostAdvancedConfiguration -Name NFS.MaxVolumes -Value 32
Set-VMHostAdvancedConfiguration -Name Net.TcpipHeapMax -Value 120
Set-VMHostAdvancedConfiguration -Name Net.TcpipHeapSize -Value 30
Set-VMHostAdvancedConfiguration -Name NFS.HeartbeatFrequency -Value 12
Set-VMHostAdvancedConfiguration -Name NFS.HeartbeatDelta -Value 12
Set-VMHostAdvancedConfiguration -Name NFS.HeartbeatMaxFailures -Value 10

Connect-VIServer VISERVER
$hostcreds = Get-Credential

Get-VMHost | ForEach-Object {
Write-Host "Optimizing $($_.Name) ..."
Connect-VIServer -server $_.Name -Credential $hostcreds
Disconnect-VIServer -Confirm:$false

The settings are as per the recommendations on the above blog posts and this EMC document.

Regarding the lines 5-6. The settings are taken from this knowledgebase article, seeing that in the EMC document and on Scott's blog the recommendation is multiply the values by the same number that you multiplied NFS.MaxVolumes  - but taking into account that the maximum value for Net.TcpipHeapMax is 120, I could not multiply it by 4.

Lines 12-13: The action must be performed against the ESX host directly, so I gather the credentials for each the ESX Host.

The rest is pretty self-explanatory.

It goes without saying that you have to reboot your Host in order for these settings to take effect.