VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

esxcli getting fc/nic driver/firmware version

Hi

trying to get driver/firmware versions with this

$results= @()

$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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The error in the FC report is due to your line

$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}}

$results2 += $results2

Those should be

$result2 = $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}}

$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

View solution in original post

Reply
0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

The error in the FC report is due to your line

$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}}

$results2 += $results2

Those should be

$result2 = $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}}

$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

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

Thanks Luc, I corrected it and works now

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

I seem to be having issues displaying the driver version for FC

$Esxcli.storage.san.fc.get($_.name).driverinfo.Version column is blank

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

ok thanks for correcting that

but my FC_version is not showing correctly

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you change the expression for the calculated property?


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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you change the expression for the calculated property?


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

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

$results= @()

$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

Screen Shot 2020-07-16 at 12.48.06 PM.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm not sure why you can do it like this?

$result2 = $esxcli.Storage.san.fc.list() | Select-Object @{N="VMHost";E={$esxcli.VMHost.Name}},

Adapter,DriverName,'Node Name','Port State',Speed,'Firmware Version',DriverVersion


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

Reply
0 Kudos