Removing ESXi VIBs using PowerCLI

In this blog post I will explain how to remove an ESXi host/ Cluster VIBs using VMware PowerCLI

we have had a customer face the issue mentioned in this KBA https://kb.vmware.com/s/article/2144200 so we need to remove the unnecessary VIBs from all hosts ( a tremendous number of Hosts 😀 )

Step 1:-

Connect to vCenter and enable SSH on all hosts in your cluster

Connect-VIServer -Server ‘vCenter_IP’ -User ‘administrator@vsphere.local’ -Password ‘Password’
Get-Cluster YourClusterName | Get-VMHost 
Get-VMHost | Get-VMHostService | Where Key -EQ "TSM-SSH" | Start-VMHostService

Step 2:-

Confirm the presence of the VIBs on the cluster hosts:

$hosts = Get-Cluster YourClusterName | Get-VMHost
forEach ($vihost in $hosts)
{
$esxcli = get-vmhost $vihost | Get-EsxCli
$esxcli.software.vib.list() | Where { $_.Name -like "*vib-name*"} | Select @{N="VMHost";E={$ESXCLI.VMHost}}, Name, Version
}

Step 3:-

Remove the VIBs from all the hosts in the cluster

$hosts = Get-Cluster YourClusterName | Get-VMHost
forEach ($vihost in $hosts)
{
$esxcli = get-vmhost $vihost | Get-EsxCli
$vib-name=$esxcli.software.vib.list() | Where { $_.Name -like "*vib-name*"}
$vib-name | ForEach { $esxcli.software.vib.remove($false,$true,$false,$true,$_.Name)}
}

Step 4:-

Enter each host in maintenance mode and reboot

$hosts = Get-Cluster ClusterName | Get-VMHost
forEach ($vihost in $hosts)
{
$esxcli = get-vmhost $vihost | Get-EsxCli
$esxcli.system.maintenanceMode.set($true)
$esxcli.system.shutdown.reboot(10,"UninstallingPP")

Step 5:-

Disable SSH on all hosts in the cluster

Get-Cluster YourClusterName | Get-VMHost | ForEach {Stop-VMHostService -HostService ($_ |
Get-VMHostService | Where {$_.Key -eq “TSM-SSH”}) -Confirm:$FALSE}

Enjoy 🙂

One thought on “Removing ESXi VIBs using PowerCLI

Add yours

  1. best not to use a “-” in a variable name. Also Get-EsxCli doesnt require you to first enable SSH. You can remove step 1 and 5.

    Like

Leave a comment

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

Website Powered by WordPress.com.

Up ↑