go2.wordpress[1]  image_thumb[1] 

After reading Jase’s post http://www.jasemccarty.com/blog/?p=532 about setting the advanced configuration settings. I wanted to create a script and add it to the Community Powerpack (more info about the Powerpack here: http://www.virtu-al.net/2010/06/04/goodbye-virtu-al-hello-community/)

So I created two PowerCLI scripts to achieve this. You can see a short demo here:

 

This script will be added to the new version of the Powerpack.If you don’t want to wait until  the new version of the Community Powerpack comes online, you can use the following script to set the advanced settings on all of your ESX hosts:

param(
    [parameter(Mandatory = $true)]
    [string[]]$vCenter
)

Connect-VIServer $vCenter

$esxHosts = Get-VMHost | Sort Name
foreach($esx in $esxHosts){
    Write-Host "Updating TCP and NFS Advanced Configuration Settings on $esx"

    # Update TCP Settings
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name Net.TcpipHeapSize).Values -ne "30"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name Net.TcpipHeapSize -Value 30 -Confirm:$false
    }
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name Net.TcpipHeapMax).Values -ne "120"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name Net.TcpipHeapMax -Value 120 -Confirm:$false
    }

    # Update NFS Settings
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatMaxFailures).Values -ne "10"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatMaxFailures -Value 10 -Confirm:$false
    }
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatFrequency).Values -ne "12"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatFrequency -Value 12 -Confirm:$false
    }
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatTimeout).Values -ne "5"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.HeartbeatTimeout -Value 5 -Confirm:$false
    }
    if((Get-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.MaxVolumes).Values -ne "64"){
        Set-VMHostAdvancedConfiguration -VMHost $esx -Name NFS.MaxVolumes -Value 64 -Confirm:$false
    }
}

 

You can start the script with the parameter –vCenter in my case this is vc01:

image

The script will generate the following output.

image

Note on the first ESX host I already changed the NFS.HeartbeatFrequency during the test of the cmdlets.

Advertisement

One thought on “PowerCLI: Changing Advanced Configuration Settings for NFS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.