Installed VIB information on ESXi

I came across multiple situations where customer would like to get the information of a particular module version that is installed on their ESXi hosts (for upgrading the module or to make sure entire inventory on the same level) and collecting the data by logging into each ESXi host is a tedious job.

So I though of writing a script (of course with the help of Google :)) that will help in collecting the information of the selected vib that is installed on the ESXi hosts and generate a csv file that can be referred later.

#Author: Mallikarjun Immadi
#https://www.vpxd.in
$vCenterServer = Read-Host "Enter vCenter Server FQDN or IP Address"
Connect-VIServer $vCenterServer
$datetime=Get-Date -format "MMddyyyy-HHmmss"
$outFilePath="C:\Users\mallikarjun\Documents\qfle3fDriverInfo-$datetime.csv"
$ehosts = (Get-VMHost).Name | where {($_.ConnectionState -notlike "notresponding")}
Write-Output "HostName,AcceptanceLevel,CreationDate,ID,InstallDate,Name,Status,Vendor,Version" | Out-File $outFilePath
foreach($ehost in $ehosts) {
$esxcli = Get-ESXCli -VMHost $ehost
$vibInfo = $esxcli.software.vib.list()
	foreach ($info in $vibInfo) {
		if($info.name -contains "qfle3f") {
			$ehost + "," + $info.AcceptanceLevel + "," + $info.CreationDate+ "," + $info.ID+ "," + $info.InstallDate +"," + $info.Name+"," + $info.Status +"," + $info.Vendor+"," + $info.Version|Out-File $outFilePath -Append
		}
	}
}

Script can be downloaded from here also.

I created this script to fetch the qfle3 module. However, it can be changed to required module in line 13 as per requirement.