Hi
trying to get driver/firmware versions with this
$results2= @()
$vmhosts = get-vmhost (get-content ".\esxhosts.txt")
foreach ($vmhost in $vmhosts) {
$esxcli = get-esxcli -VMHost $vmhost
$result = $Esxcli.network.nic.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}}, *, @{N="FirmwareVersion"; E={$Esxcli.network.nic.get($_.name).driverinfo.firmwareVersion}}, @{N="Version"; E={$Esxcli.network.nic.get($_.name).driverinfo.Version}}
$results2 = $esxcli.Storage.san.fc.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}}, *, @{N="FC_FirmwareVersion"; E={$Esxcli.storage.san.fc.get($_.name).driverinfo.firmwareVersion}}, @{N="Version"; E={$Esxcli.storage.san.fc.get($_.name).driverinfo.Version}}
#$result = $Esxcli.network.nic.list() | select @{N="VMhost";E={$esxcli.vmhost.name}}, *
$results += $result
$results2 += $results2
}
#$results
$results | export-csv ".\vmhostnicdriverversions.csv" -NoTypeInformation -UseCulture
$results2 | export-csv ".\vmhostfcdriverversions.csv" -NoTypeInformation -UseCulture
but I keep getting this error
Select-Object: /Users/twong/Powershell/Vmware/get_drivers_version.ps1:12:45
Line |
12 | … fc.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}}, *, @ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property cannot be processed because the property "FirmwareVersion" already exists.
also the FC report only shows 1 host and not my other hosts
The error in the FC report is due to your line
$results2 += $results2
Those should be
$results2 += $result2
The error you are showing doesn't seem to correspond with the code you included (FC_FirmwareVersion vs FirmwareVersion)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The error in the FC report is due to your line
$results2 += $results2
Those should be
$results2 += $result2
The error you are showing doesn't seem to correspond with the code you included (FC_FirmwareVersion vs FirmwareVersion)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc, I corrected it and works now
I seem to be having issues displaying the driver version for FC
$Esxcli.storage.san.fc.get($_.name).driverinfo.Version column is blank
Are you sure that $Esxcli.storage.san.fc.get is a valid command?
I only seem to have list, not get.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok thanks for correcting that
but my FC_version is not showing correctly
Did you change the expression for the calculated property?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you change the expression for the calculated property?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
$results2= @()
$vmhosts = get-vmhost (get-content ".\esxhosts.txt")
foreach ($vmhost in $vmhosts) {
$esxcli = get-esxcli -VMHost $vmhost
$result = $Esxcli.network.nic.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}},
*,
@{N="FirmwareVersion"; E={$Esxcli.network.nic.get($_.name).driverinfo.firmwareVersion}},
@{N="Version"; E={$Esxcli.network.nic.get($_.name).driverinfo.Version}}
$result2 = $esxcli.Storage.san.fc.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}},
@{N="Adapter"; E={$esxcli.storage.san.fc.list($_.name).Adapter}},
@{N="DriverName"; E={$esxcli.storage.san.fc.list($_.name).DriverName}},
@{N="NodeName"; E={$esxcli.storage.san.fc.list($_.name).NodeName}},
@{N="PortState"; E={$esxcli.storage.san.fc.list($_.name).Portstate}},
@{N="Speed"; E={$esxcli.storage.san.fc.list($_.name).Speed}},
@{N="FirmwareVersion"; E={$Esxcli.storage.san.fc.list($_.name).firmwareVersion}},
@{N="driverversion"; E={$Esxcli.storage.san.fc.list($_.name).driverversion}}
#$result = $Esxcli.network.nic.list() | select @{N="VMhost";E={$esxcli.vmhost.name}}, *
$results += $result
$results2 += $result2
}
#$results
#$results2
$results | export-csv ".\vmhostnicdriverversions.csv" -NoTypeInformation -UseCulture
$results2 | export-csv ".\vmhostfcdriverversions.csv" -NoTypeInformation -UseCulture
Its displaying the NIC just fine but for FC its showing it like this
I'm not sure why you can do it like this?
Adapter,DriverName,'Node Name','Port State',Speed,'Firmware Version',DriverVersion
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference