1 minute read

I did not work with PowerCli for the last couple of months and I had an interesting question from one of my follower Ivo from Netherlands.

He was trying to retrieve the VIB information with the name net-e1000e from all his VMware Hosts using the PowerShell and the Snapin PowerCli from VMware.

What is a VIB ? VIB stands for vSphere Installation Bundle. At a conceptual level a VIB is somewhat similar to a tarball or ZIP archive in that it is a collection of files packaged into a single archive to facilitate distribution

Here is the piece of code to retrieve this information. The output is sent to Out-GridView which create a simple GUI.

Get-VMHost | Where-Object { $_.ConnectionState -eq "Connected" } | Foreach-Object {
    $CurrentVMhost = $_
    TRY
    {
        # Exposes the ESX CLI functionality of the current host
        $ESXCLI = Get-EsxCli -VMHost $CurrentVMhost.name
        # Retrieve Vib with name 'net-e1000e'
        $ESXCLI.software.vib.list() | Where-Object { $_.Name -eq "net-e1000e" } |
        FOREACH
        {
            $VIB = $_
            $Prop = [ordered]@{
                'VMhost' = $CurrentVMhost.Name
                'ID' = $VIB.ID
                'Name' = $VIB.Name
                'Vendor' = $VIB.Vendor
                'Version' = $VIB.Version
                'Status' = $VIB.Status
                'ReleaseDate' = $VIB.ReleaseDate
                'InstallDate' = $VIB.InstallDate
                'AcceptanceLevel' = $VIB.AcceptanceLevel
            }#$Prop
            # Output Current Object
            New-Object PSobject -Property $Prop
        }#FOREACH
    }#TRY
    CATCH
    {
        Write-Warning -Message "Something wrong happened with $($CurrentVMhost.name)"
        Write-Warning -Message $Error[0].Exception.Message
    }
} | Out-GridView

Script Version

I also wrote a more complete version available on Github

Leave a comment