VMware Cloud Community
tdubb123
Expert
Expert

vib output

trying to find a vib on my hosts having a problem with the output

$data = @()

$vmhosts = get-vmhost -name (get-content esxhosts.txt)

foreach($vmhost in $vmhosts){

$esxcli = $vmhost | get-esxcli

$item = "" | select Host, vib

$item.host = $vmhost.name

$item.vib = $esxcli.software.vib.list() | ? {$_.name -eq "test*"} | select Name

$data += $item

}

$data | out-gridview

but the vib output is strange

@{Name=test}

any idea how to correct this

0 Kudos
1 Reply
LucD
Leadership
Leadership

Try something like this

$vmhosts = Get-VMHost -Name (Get-Content esxhosts.txt)

Get-VMHost -Name $vmhosts | ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $vmhost

    $esxcli.software.vib.list() | ? {$_.name -like "esx*"} |

    Select @{N='VMHost';E={$vmhost.Name}},Name

} | Out-GridView


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos