PowerCLI Script – ESXi – Remove the intelcim-provider VIB and disable the MSI-X/MSI interrupt scheme

PowerCLI
  • Goal – Remove the intelcim-provider VIB and disable the MSI-X/MSI interrupt scheme via a PowerCLI script by Cluster for a specific Manufacturer. $Manufacturer is HP in case the script is run on the wrong Cluster. The script will filter for connected ESXi hosts in the cluster.
  • Some if the reasons why to make the change – https://kb.vmware.com/s/article/2014323
    https://vm.knutsson.it/2017/08/esxi-6-5-update-1-psod-on-hpe-460c-gen9-after-ixgben-driver-update/
  • Since I do not have any HP or QLogic hardware; I chose an ESXi host running in VMware Workstatin – $Manufacturer = “VMware, Inc.”
  • The script can be used as a template for all hosts in a cluster changes via get-esxcli -V2 and Get-VMHostModule to avoid SSH’ing into each host by hand.
#  Found https://vmscribble.com/powercli/powercli-script-esxi-remove-the-intelcim-provider-vib-and-disable-the-msi-x-msi-interrupt-scheme

#Variables
$vCenter = Read-Host "Enter the FQDN of the vCenter"
$Cluster = Read-Host "Enter the Cluster Name"
$Manufacturer = "VMware, Inc."

# Connect to the vCenter
Connect-VIServer $vCenter | Out-Null
$esxiihost = Get-Cluster $cluster | Get-VMHost | Where-Object {$_.Manufacturer -match "$Manufacturer"} | Where-Object {$_.ConnectionState -eq "Connected"}

foreach ($esxi in $esxiihost)
{
    # MSI fix
    Write-host "Step 1 - Set ql2xenablemsix=0 on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHostModule -VMHost $esxi -Name "qlnativefc" | Set-VMHostModule -Options "ql2xenablemsix=0"
    
    # Stop CIM Provider Servicer
    Write-host "Step 2 - Stopping CIM sfcbd-watchdog on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHost -Name $esxi | Foreach {
   Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "sfcbd-watchdog"} ) -Confirm:$false | Out-Null
}

    # Remove intel cim-provider vib:
    Write-host "Step 3 - Remove VIB intelcim-provider on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHost -Name $esxi | Foreach {
	$esxicli = get-esxcli -V2 -VMHost $_
    $esxicli.software.vib.remove.Invoke(@{"vibname" = "intelcim-provider"})
}

    # Start CIM Provider Service
    Write-host "Step 4 - Starting CIM sfcbd-watchdog on ESXi host: $esxi
    " -ForegroundColor Green
      Get-VMHost -Name $esxi | Foreach {
   Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "sfcbd-watchdog"} ) | Out-Null
}  
}

Write-host "
Success for ESXi hosts in Cluster $cluster - if blank, they are not Manufacturer $Manufacturer -  $esxiihost" -ForegroundColor Green
Write-Host "
Make sure to Maintenance Mode and Reboot the host for the MSI-X fix to take effect.  The intelcim-provider removal is real-time.
" -ForegroundColor Green

# Disconnect from the vCenter
Disconnect-VIServer $vCenter -Confirm:$false
Information
  • Goal – Remove the intelcim-provider VIB and disable the MSI-X/MSI interrupt scheme via a PowerCLI script by Cluster for a specific Manufacturer. $Manufacturer is HP in case the script is run on the wrong Cluster. The script will filter for connected ESXi hosts in the cluster.
  • Some if the reasons why to make the change – https://kb.vmware.com/s/article/2014323
    https://vm.knutsson.it/2017/08/esxi-6-5-update-1-psod-on-hpe-460c-gen9-after-ixgben-driver-update/
  • Since I do not have any HP or QLogic hardware; I chose an ESXi host running in VMware Workstatin – $Manufacturer = “VMware, Inc.”
  • The script can be used as a template for all hosts in a cluster changes via get-esxcli -V2 and Get-VMHostModule to avoid SSH’ing into each host by hand.
The Script
#  Found https://vmscribble.com/powercli/powercli-script-esxi-remove-the-intelcim-provider-vib-and-disable-the-msi-x-msi-interrupt-scheme

#Variables
$vCenter = Read-Host "Enter the FQDN of the vCenter"
$Cluster = Read-Host "Enter the Cluster Name"
$Manufacturer = "VMware, Inc."

# Connect to the vCenter
Connect-VIServer $vCenter | Out-Null
$esxiihost = Get-Cluster $cluster | Get-VMHost | Where-Object {$_.Manufacturer -match "$Manufacturer"} | Where-Object {$_.ConnectionState -eq "Connected"}

foreach ($esxi in $esxiihost)
{
    # MSI fix
    Write-host "Step 1 - Set ql2xenablemsix=0 on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHostModule -VMHost $esxi -Name "qlnativefc" | Set-VMHostModule -Options "ql2xenablemsix=0"
    
    # Stop CIM Provider Servicer
    Write-host "Step 2 - Stopping CIM sfcbd-watchdog on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHost -Name $esxi | Foreach {
   Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "sfcbd-watchdog"} ) -Confirm:$false | Out-Null
}

    # Remove intel cim-provider vib:
    Write-host "Step 3 - Remove VIB intelcim-provider on ESXi host: $esxi" -ForegroundColor Green
    Get-VMHost -Name $esxi | Foreach {
	$esxicli = get-esxcli -V2 -VMHost $_
    $esxicli.software.vib.remove.Invoke(@{"vibname" = "intelcim-provider"})
}

    # Start CIM Provider Service
    Write-host "Step 4 - Starting CIM sfcbd-watchdog on ESXi host: $esxi
    " -ForegroundColor Green
      Get-VMHost -Name $esxi | Foreach {
   Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "sfcbd-watchdog"} ) | Out-Null
}  
}

Write-host "
Success for ESXi hosts in Cluster $cluster - if blank, they are not Manufacturer $Manufacturer -  $esxiihost" -ForegroundColor Green
Write-Host "
Make sure to Maintenance Mode and Reboot the host for the MSI-X fix to take effect.  The intelcim-provider removal is real-time.
" -ForegroundColor Green

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