Hi All,
mattboren has created the below script to list the BIOS and various hardware version & firmware version:
## Script function: quickly get BIOS date, Smart Array FW version, and iLO FW version for HP hosts in a given location (folder, cluster, datacenter, etc.)
## Author: vNugglets.com -- Sep 2011
## folder in which hosts in which we are interested reside
#$strHostsFolderName = "myFolder"
#Get-View -ViewType HostSystem -Property Name, Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo -SearchRoot (Get-View -ViewType Folder -Property Name -Filter @{"Name" = "^$([RegEx]::escape($strHostsFolderName))$"}).MoRef | %{
## cluster in which hosts in which we are interested reside
$strHostsClusterName = "Production"
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*"}
$nsiNXdev = $arrNumericSensorInfo | ? {$_.Name -like "nx_nic device*"}
$nsiNXdrv = $arrNumericSensorInfo | ? {$_.Name -like "nx_nic driver*"}
if ( $nsiNXdev.Count -gt 0 ) {
$nsiNXdevice = $nsiNXdev[0].Name
} else {
$nsiNXdevice = "n/a"
}
if ( $nsiNXdrv.Count -gt 0 ) {
$nsiNXdriver = $nsiNXdrv[0].Name
} else {
$nsiNXdriver = "n/a"
}
New-Object PSObject -Property @{
VMHost = $_.Name
"SystemBIOS" = $nsiBIOS.name
"HPSmartArray" = $nsiArrayCtrlr.Name
"iLOFirmware" = $nsiILO.Name
"nx_nic device" = $nsiNXdevice
"nx_nic driver" = $nsiNXdriver
} ## end new-object
} | Export-Csv C:\temp\Production-BLadeG7.csv ## end Foreach-Object
However, I'd like to modify it to show up the NIC driver and firmware version but still failed.
Any kind of help and suggestion would be greatly appreciated.
Thanks.
Try like this
$strHostsClusterName = "Production"
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:\temp\Production-BLadeG7.csv ## end Foreach-Object
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can get the NIC info as I showed in 1. Re: How to get Network Card driver and firmware version on the using PowerCLI ?
But how would you like to show that in the CSV ?
One line per NIC ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes that's the idea of the script.
Wthst oils that be possible @lucd ?
Don't have HP hardware to test, but does this do the trick ?
## Script function: quickly get BIOS date, Smart Array FW version, and iLO FW version for HP hosts in a given location (folder, cluster, datacenter, etc.)
## Author: vNugglets.com -- Sep 2011
## folder in which hosts in which we are interested reside
#$strHostsFolderName = "myFolder"
#Get-View -ViewType HostSystem -Property Name, Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo -SearchRoot (Get-View -ViewType Folder -Property Name -Filter @{"Name" = "^$([RegEx]::escape($strHostsFolderName))$"}).MoRef | %{
## cluster in which hosts in which we are interested reside
$strHostsClusterName = "Production"
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) | %{
New-Object PSObject -Property @{
VMHost = $esxName
"SystemBIOS" = $nsiBIOS.name
"HPSmartArray" = $nsiArrayCtrlr.Name
"iLOFirmware" = $nsiILO.Name
"nx_nic device" = $_.Name
"nx_nic driver" = $_.DriverInfo.Driver
} ## end new-object
}
}
} | Export-Csv C:\temp\Production-BLadeG7.csv ## end Foreach-Object
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD, many thanks for the assistance.
I never thought that this is possible with the same PowerCLI:
$strHostsClusterName = "Production"
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) | %{
New-Object PSObject -Property @{
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
}
}
} | Export-Csv C:\temp\Production-BLadeG7.csv ## end Foreach-Object
Special tahnks to mattboren for creating such a great script initially now it is modified for completeness :smileycool:
Quick question,
is there any reason as to why the column order is somehow randomized everytime i execute it against different DRS cluster ?
HPSmartArray | nx_nic device | nx_nic driver version | iLOFirmware | nx_nic firmware version | nx_nic driver | VMHost | SystemBIOS |
is there any way to sort or re-arrange the column name to certain order ?
VMHost, iLOFirmware, HPSmartArray, nx_nic device, nx_nic driver, nx_nic driver version, nx_nic firmware version, SystemBIOS
Thanks,
Yes, that is normal, there is no control over the order of the properties in an object you create.
In PowerShell v3 the [ordered] cast was introduced.
That allows to create an object where the order of the properties is kept.
Are you on PowerShell v3 (or higher) ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
I'm using Windows 8.1U1 so It is PS 4.0:
Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.
PS H:\> Get-Host
Name : ConsoleHost
Version : 4.0
InstanceId : ac3fc0e4-ab3b-4afd-a350-761a8f127209
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-AU
CurrentUICulture : en-GB
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS H:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
PS H:\>
Try like this
$strHostsClusterName = "Production"
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:\temp\Production-BLadeG7.csv ## end Foreach-Object
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes LucD that works perfect !
Many thanks for the sharing and the assitance here.
the script is getting better all the times.