Hello all,
I'm having a hard time figuring out how to get the firmware version of the blade that my ESXi is sitting on. Trying to get this info from a data center that is running both Cisco UCS and HP blade systems. I am unfortunately still running PowerCLI version 5.8 and cannot upgrade anytime soon.
This info is to be incorporated into a script that gathers the following:
I am using the following to gather everything else:
$report = Get-Cluster "cluster-name" | % {
$datacenter=$_
foreach($esx in Get-VMhost -Location $datacenter){
$esxcli = Get-EsxCli -VMHost $esx
$nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1 | select -ExpandProperty Name
$hba =Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} | Select -First 1 |select -ExpandProperty Name
Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |
Select @{N="Datacenter";E={$datacenter.Name}},
@{N="VMHost";E={$esx.Name}},
@{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},
@{N="version";E={$esx.version}},
@{N="Build";E={$esx.build}},
@{N="Manufacturer";E={$esx.Manufacturer}},
@{N="Hostmodel";E={$esx.Model}},
@{N='Driver';E={$esx.DriverInfo.Driver}},
@{N='Version';E={$esx.DriverInfo.Version}},
@{N='Firmware Version';E={$esx.DriverInfo.FirmwareVersion}},
@{N="BIOS date";E={$esx.Hardware.BiosInfo.releaseDate}},
@{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},
@{N="Cluster";E={
if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}
else{
Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name
}}},
Device,Model,Status,
@{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},
@{N="enicdriver";E={$esxcli.system.module.get("enic").version}}
}
}
Thanks in advance for any suggestions.
Hi Gratts,
Try this one for the HP Blade server:
$strHostsClusterName = "PRODUCTION 1"
Get-View -ViewType HostSystem -Property Name, Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo -SearchRoot (Get-View -ViewType ClusterComputeResource -Property Name -Filter @{"Name" = "^$([RegEx]::escape($strHostsClusterName))$"}).MoRef | %{
$arrNumericSensorInfo = @($_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo)
# HostNumericSensorInfo for BIOS, iLO, array controller
$nsiBIOS = $arrNumericSensorInfo | ? {$_.Name -like "*System BIOS*"}
$nsiArrayCtrlr = $arrNumericSensorInfo | ? {$_.Name -like "HP Smart Array Controller*"}
$nsiILO = $arrNumericSensorInfo | ? {$_.Name -like "Hewlett-Packard BMC Firmware*"}
$esxName = $_.Name
$esxcli = Get-EsxCli -VMHost $_.Name
$esxcli.network.nic.list() | %{
$esxcli.network.nic.get($_.Name) | %{
$props = [ordered]@{
VMHost = $esxName
"SystemBIOS" = $nsiBIOS.name
"HPSmartArray" = $nsiArrayCtrlr.Name
"iLOFirmware" = $nsiILO.Name
"nx_nic device" = $_.Name
"nx_nic driver" = $_.DriverInfo.Driver
"nx_nic driver version" = $_.DriverInfo.Version
"nx_nic firmware version" = $_.DriverInfo.FirmwareVersion
} ## end new-object
New-Object PSObject -Property $props
}
}
} | Export-Csv C:\RESULT\PRODUCTION.csv ## end Foreach-Object
I use it before I plan for Firmware update.
All you need to do is to customize the blue keyword between the double quote.
Hope this helps
When I execute your script:
$report = Get-Cluster | % {
$datacenter=$_
foreach($esx in Get-VMhost -Location $datacenter){
$esxcli = Get-EsxCli -VMHost $esx
$nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1 | select -ExpandProperty Name
$hba =Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} | Select -First 1 |select -ExpandProperty Name
Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |
Select @{N="Datacenter";E={$datacenter.Name}},
@{N="VMHost";E={$esx.Name}},
@{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},
@{N="version";E={$esx.version}},
@{N="Build";E={$esx.build}},
@{N="Manufacturer";E={$esx.Manufacturer}},
@{N="Hostmodel";E={$esx.Model}},
@{N='Driver';E={$esx.DriverInfo.Driver}},
@{N='Version';E={$esx.DriverInfo.Version}},
@{N='Firmware Version';E={$esx.DriverInfo.FirmwareVersion}},
@{N="BIOS date";E={$esx.Hardware.BiosInfo.releaseDate}},
@{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},
@{N="Cluster";E={
if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}
else{
Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name
}}},
Device,Model,Status,
@{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},
@{N="enicdriver";E={$esxcli.system.module.get("enic").version}}
}
}
The script above does not work with the below error:
WARNING:
The Get-EsxCli cmdlet provides a new interface to the ESXCLI functionality.
Use the -V2 parameter to switch to the new cmdlet interface.
Check the cmdlet help for more information.
Scripts that use the old cmdlet interface may not be compatible across two different versions of the ESX server.
The old cmdlet interface is deprecated and will be removed in a future version.
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba1:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba64:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba1:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba64:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba1:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
Select : The property cannot be processed because the property "Version" already exists.
At C:\Users\Admin\AppData\Local\Temp\137aa190-c242-416e-a90d-095bac32a56f.ps1:9 char:9
+ Select @{N="Datacenter";E={$datacenter.Name}},
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (vmhba64:FibreChannel:online:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
My PowerCLI version is as follows:
PS C:\Users\Admin\Documents> Get-PowerCLIVersion
PowerCLI Version
---------------
VMware vSphere PowerCLI 6.3 Release 1 build 3737840
---------------
Component Versions
---------------
VMware Cloud Infrastructure Suite PowerCLI Component 6.3 build 3709081
VMWare AutoDeploy PowerCLI Component 6.0 build 3736841
VMWare ImageBuilder PowerCLI Component 6.0 build 3736841
VMware vSphere PowerCLI Component 6.3 build 3709081