Disable Delayed Acknowledgement Setting in iSCSI Software Adapter using PowerCLI

Summary:

Somebody posed this question in the vmware communities forum.  I figured out how to do it cheating w/ Onyx.  Not sure why this is needed (since I don’t use iSCSI much), but figure it’s best I post this for reference if I or anyone needs to do this particular task.

Script:

#This section will get host information needed
$HostView = Get-VMHost NameofESXServer | Get-View
$HostStorageSystemID = $HostView.configmanager.StorageSystem
$HostiSCSISoftwareAdapterHBAID = ($HostView.config.storagedevice.HostBusAdapter | where {$_.Model -match "iSCSI Software"}).device
 
#This section sets the option you want.
$options = New-Object VMWare.Vim.HostInternetScsiHbaParamValue[] (1)
 
$options[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue
$options[0].key = "DelayedAck"
$options[0].value = $false
 
#This section applies the options above to the host you got the information from.
$HostStorageSystem = Get-View -ID $HostStorageSystemID
$HostStorageSystem.UpdateInternetScsiAdvancedOptions($HostiSCSISoftwareAdapterHBAID, $null, $options)

You can have this script run against multiple ESX servers, but you will need to use the Foreach-Object cmdlet.

Comments

Alex.M said…
This comment has been removed by a blog administrator.
virtupædia said…
Expanded upon your code a bit as well:

param(
[parameter(Mandatory=$false,ValueFromPipeline=$True)] $VIServer,
[parameter(Mandatory=$false,ValueFromPipeline=$True)] $VMHost
)
begin{
if ($VIServer){
if ($defaultviserver.ExtensionData.CurrentTime() -and $defaultVIServer.Name -eq $VIServer){
Write-Host -Fore Green "Connected to $VIServer"
}else{
Connect-VIServer $VIServer
}
$VMHost=Get-Datacenter -Server (Get-VIServer $VIServer -ea Stop) | Get-Cluster | Get-VMHost
}elseif ($VMHost){
$VMHost=Get-VMHost $VMHost*
}else{
Write-Host -Fore Yellow "Please provide either a VCenter Server or ESXi Host"
}
}
process {
$VMHost | %{
$local:VMHost = $_
Write-Progress -Status $VMHost -Activity "Processing host from Cluster"
$hba=( $VMHost | Get-VMHostHba |?{ $_.status -eq "online" -and $_.IsSoftwareBased -eq $true })
$hba | %{
$local:hba=$_
Write-Progress $hba -Activity "Processing HBA"
if ($_.ExtensionData.AdvancedOptions |?{ $_.Key -eq "DelayedAck" -and $_.Value -eq $true } ){
$NodeStorageSystem=Get-View ( $VMHost | Get-View ).configmanager.StorageSystem
$options = New-Object VMWare.Vim.HostInternetScsiHbaParamValue[](1)
$options[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue
$options[0].key = "DelayedAck"
$options[0].value = $false
$options[0].key = ""
$options[0].value = $false
if ($NodeStorageSystem.UpdateInternetScsiAdvancedOptions($hba, $null, $options)){
Write-Host -ForegroundColor Green "Updated $hba on $VMHost with $options"
}else{
Write-Error "Failed to udpate $hba on $VMHost with $options"
}

}else{
Write-Host -ForegroundColor Green "Hba delayAck already disabled for $hba on $VMHost"
}
}
}
}
virtupædia said…
go ahead and delete my previous post.
Noticed a bug.

Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

Azure VMware Solution: NSX-T Active/Active T0 Edges...but