Hello All,
Greetings!
from this community i got below script which is used by "Guru" wherever any firmware upgrade is planned for HP servers..
i have been asked to do such task and am in the process of gathering the information from vcenter for all the HP servers , below script is working perfect. but it is missing ilo ip details. someone help on this part.
$strHostsClusterName = "Cluster Name" <want it to run all the hosts in the Vcenter>
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:\inventory.csv
Have you installed the HPEiLOCmdlets module?
Note that these support ILO3 and above.
For ILO2 you will have to use the CLI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried installing , seeing below messages
PS C:\WINDOWS\system32> Install-Module -Name HPEiLOCmdlets
WARNING: Version '2.0.0.0' of module 'HPEiLOCmdlets' is already installed at 'C:\Program Files (x86)\WindowsPowerShell\Modules\HPEiLOCmdlets\2.0.0.0'. To install version '2.2.0.0', run Install-Module and add the -F
orce parameter, this command will install version '2.2.0.0' in side-by-side with version '2.0.0.0'.
PS C:\WINDOWS\system32> Install-Module -Name HPEiLOCmdlets -Force
WARNING: The specified module 'HPEiLOCmdlets' with PowerShellGetFormatVersion '2.0' is not supported by the current version of PowerShellGet. Get the latest version of the PowerShellGet module to install this modul
e, 'HPEiLOCmdlets'.
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.1146
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.1146
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
================================ When I execute script seeing following ============
Get-EsxCli : 6/21/2019 1:05:06 PM Get-EsxCli An error occurred while communicating with the remote host.
At line:11 char:15
+ $esxcli = Get-EsxCli -VMHost $_.Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-EsxCli], HostCommunication
+ FullyQualifiedErrorId : Client20_DynamicTypeManagerServiceImpl_GetMoInstances_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.GetEsxCli
You cannot call a method on a null-valued expression.
At line:12 char:5
+ $esxcli.network.nic.list() | %{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Get-EsxCli : 6/21/2019 1:05:09 PM Get-EsxCli An error occurred while communicating with the remote host.
At line:11 char:15
+ $esxcli = Get-EsxCli -VMHost $_.Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-EsxCli], HostCommunication
+ FullyQualifiedErrorId : Client20_DynamicTypeManagerServiceImpl_GetMoInstances_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.GetEsxCli
You cannot call a method on a null-valued expression.
At line:12 char:5
+ $esxcli.network.nic.list() | %{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Get-EsxCli : 6/21/2019 1:05:10 PM Get-EsxCli An error occurred while communicating with the remote host.
At line:11 char:15
+ $esxcli = Get-EsxCli -VMHost $_.Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-EsxCli], HostCommunication
+ FullyQualifiedErrorId : Client20_DynamicTypeManagerServiceImpl_GetMoInstances_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.GetEsxCli
You cannot call a method on a null-valued expression.
At line:12 char:5
+ $esxcli.network.nic.list() | %{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You will need to update PowerShellGet in that case.
See UPDATE POWERSHELLGET AND PACKAGEMANAGEMENT for instructions.
On the other hand, I suspect version 2.0.0 of the module will allow you to get the iLO firmware version as well.
There seems to be a problem communicating with that specific ESXi node.
There could be several causes of such a problem: DNS, FW...
That is something that is hard to diagnose remotely.
Can you open an SSH connection (first enable SSH if needed) with that ESXi node?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was about to edit it, noticed target hosts are in disconnected state due to which i see communication message.
I tried to execute same code on another cluster where hosts are in connected state it worked well, but out put does not captured ilo ip of esxi hosts and esxi model
VMHost SystemBIOS HPSmartArray iLOFirmware nx_nic device nx_nic driver nx_nic driver version nx_nic firmware version
Did you use the cmdlet from the iLO module for that?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't have access to a HP server with an iLO board, I'm afraid I can't help you there.
Perhaps try asking the question in the HP Forum.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
you can try using the below command to fetch ILO information.
$esxcli.hardware.ipmi.bmc.get.Invoke()
BMCFirmwareVersion : 1.15
IPMIVersion : 2.0
IPv4Address : 10.x.x.x
IPv4Gateway : 10.x.x.x
IPv4Subnet : 255.255.255.0
IPv6Addresses :
LANifAdminStatus : true
MACAddress :
Manufacturer : Unknown
OSNameReported : VMware ESXi 6.
how do i add it to the existing script.?
$strHostsClusterName = "Cluster Name" <want it to run all the hosts in the Vcenter>
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
$ipv4Addr = $esxcli.hardware.ipmi.bmc.get.Invoke().ipv4Addres
$esxcli.network.nic.list() | %{
$esxcli.network.nic.get($_.Name) | %{
$props = [ordered]@{
VMHost = $esxName
"SystemBIOS" = $nsiBIOS.name
"HPSmartArray" = $nsiArrayCtrlr.Name
"iLOFirmware" = $nsiILO.Name
"ILOIPV4Addr" = $ipv4Addr
"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:\inventory.csv
I think the above will work for you.
$strHostsClusterName = "Cluster Name" <want it to run all the hosts in the Vcenter>
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:\inventory.csv
When i execute , i see following 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.
You cannot call a method on a null-valued expression.
At line:19 char:5
+ $ipv4Addr = $esxcli.hardware.ipmi.bmc.get.Invoke().ipv4Addres
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:19 char:5
+ $ipv4Addr = $esxcli.hardware.ipmi.bmc.get.Invoke().ipv4Addres
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:19 char:5
+ $ipv4Addr = $esxcli.hardware.ipmi.bmc.get.Invoke().ipv4Addres
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull