PowerCLI – HPE – ESXi iSCSI Advanced Options

PowerCLI
  • In the year 2024; remains true for HPE array best practice to use a value of 30 for the iSCSI NoopTimeout LoginTimeout NoopInterval Advanced Options on an ESXi 7 or 8 host iSCSI adapter.
  • https://vmscribble.com/powercli/powercli-script-hpe-nimble-iscsi-logintimeout-noopouttimeout-noopoutinterval is by Cluster using the older esxcli v1.
  • This script will make the change for a single host using vCenter and ESXi 8.0 and 7.0
  • get-view was used based on the vCenter Developer Center Code Capture when makeing the change by hand via the GUI.
  • Key note – The Adapter used is vmhba64
    Please change if your environment is different.
    line 10 – $iScsiHbaDevice = ‘vmhba64’
  • A reboot will need to take place for the 3 changes to take effect.
# found https://vmscribble.com/

Write-Host ""
Write-Host "Change the iSCSI vmhba64 Advanced Options LoginTimeout | NoopOutTimeout | NoopOutInterval to 30"
Read-Host "Press Enter to continue"

# Set Variables
$vCenter = Read-Host "Enter the vCenter Name"
$esxihost = Read-Host "Enter the ESXi host Name"
$iScsiHbaDevice = 'vmhba64'

# Connect to the vCenter
Connect-VIServer $vCenter | out-null 

# Get-View for the host
$HostView = Get-VMHost $esxihost | Get-View
$HostStorageSystemID = $HostView.configmanager.StorageSystem

# NoopTimeout
$NoopTimeout = New-Object VMware.Vim.HostInternetScsiHbaParamValue[] (1)
$NoopTimeout[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue
$NoopTimeout[0].Value = 30
$NoopTimeout[0].Key = 'NoopTimeout'
$_this = Get-View -Id $HostStorageSystemID
$_this.UpdateInternetScsiAdvancedOptions($iScsiHbaDevice, $null, $NoopTimeout)

# LoginTimeout
$LoginTimeout = New-Object VMware.Vim.HostInternetScsiHbaParamValue[] (1)
$LoginTimeout[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue
$LoginTimeout[0].Value = 30
$LoginTimeout[0].Key = 'LoginTimeout'
$_this = Get-View -Id $HostStorageSystemID
$_this.UpdateInternetScsiAdvancedOptions($iScsiHbaDevice, $null, $LoginTimeout)

# NoopInterval
$NoopInterval = New-Object VMware.Vim.HostInternetScsiHbaParamValue[] (1)
$NoopInterval[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue
$NoopInterval[0].Value = 30
$NoopInterval[0].Key = 'NoopInterval'
$_this = Get-View -Id $HostStorageSystemID
$_this.UpdateInternetScsiAdvancedOptions($iScsiHbaDevice, $null, $NoopInterval)

Write-Host ""
Write-Host "Please REBOOT $esxihost for the changes to take effect." -foregroundcolor Yellow

# Disconnect from the vCenter
Disconnect-VIServer $vCenter -Confirm:$false