Re: Problems with iLO Unauthenticated XML query (702 Views)
Reply
Occasional Visitor
Hossy
Posts: 3
Registered: ‎09-26-2013
Message 1 of 5 (740 Views)
Accepted Solution

Problems with iLO Unauthenticated XML query

[ Edited ]

I'm reading the HP iLO Scripting and Command Line Guides for iLO 2, 3, and 4 (the iLO's I have in my environment).  All three documents contain the same information for an Unauthenticated XML query.  The reason I'm focusing on this information is because I'd like to script the retrieval of the MAC address for NIC 1 for Network (PXE) boot purposes.

 

The three servers I'm testing with are:

ProLiant DL385 G6, iLO 2 v2.12

ProLiant DL385 G7, iLO 3 v1.50

ProLiant DL360p Gen8, iLO 4 v1.20

 

Using the /xmldata?item=all query, only the iLO 4 server is returning information on the NIC's.  The iLO 2 and iLO 3 servers are returning no information (similar to the short response in the documentation).

 

I have verified that the CIM_SECURITY_MASK setting is 3 on all servers.

All of these servers are running VMware ESXi 5.1 and HP SMH is not installed.

On all servers, I can log into the iLO web interface, click System Information, and see the MAC addresses of all NIC's.

 

What am I doing wrong?  What else can I check to get this information to return?

 

 

HP iLO Scripting and Command Line Guides

iLO 2: https://h20566.www2.hp.com/portal/site/hpsc/template.BINARYPORTLET/public/kb/docDisplay/resource.pro...
iLO 3: http://h20000.www2.hp.com/bc/docs/support/SupportManual/c02774508/c02774508.pdf
iLO 4: http://h20000.www2.hp.com/bc/docs/support/SupportManual/c03334058/c03334058.pdf

 

 

P.S. This thread has been moved from ProLiant Servers (ML,DL,SL) to ITRC Remote Lights-Out Mgmt (iLO 2, iLO, RILOE II) Forum. - Hp Forum Moderator

Honored Contributor
Oscar A. Perez
Posts: 643
Registered: ‎11-01-2005
Message 2 of 5 (725 Views)

Re: Problems with iLO Unauthenticated XML query

The Unauthenticated XML reply has been enhanced only in iLO4.  For older G6 and G7 servers, you can use the Get_Host_Data.xml to obtain the server NIC MAC addresses (SMBIOS record type 209)

Occasional Visitor
Hossy
Posts: 3
Registered: ‎09-26-2013
Message 3 of 5 (716 Views)

Re: Problems with iLO Unauthenticated XML query

Thanks, Oscar.  So the documentation for iLO 2 and iLO 3 is incorrect I presume?

Honored Contributor
Jimmy Vance
Posts: 1,538
Registered: ‎11-27-2006
Message 4 of 5 (714 Views)

Re: Problems with iLO Unauthenticated XML query


Hossy wrote:

Thanks, Oscar.  So the documentation for iLO 2 and iLO 3 is incorrect I presume?


Just checked the iLO2 docs, and the answer is yes/no  It has two entries, one showing data returned for an iLO2 system, and one showing data returned for an iLO4 system.  I'd say it's a good bet that the iLO4 info shouldn't really be there since it is an iLO2 document...

Occasional Visitor
Hossy
Posts: 3
Registered: ‎09-26-2013
Message 5 of 5 (702 Views)

Re: Problems with iLO Unauthenticated XML query

For inquiring minds, I figured I'd share my script.  Feel free to reuse.  All I ask is that you credit me (John Hossbach).

 

param
(
	[string]$iLOAddress,
	[string]$userName,
	[string]$password,
	[switch]$tryBoth
)

function Get-iLOVersion
{
	param
	(
		[string]$iLOAddress
	)

	$xml = New-Object System.Xml.XmlDocument
	$xml.Load("http://$iLOAddress/xmldata?item=All")
	$xml.RIMP.MP.PN
}

function Get-NIC1MAC_HTTP
{
	param
	(
		[string]$iLOAddress
	)

	$xml = New-Object System.Xml.XmlDocument
	$xml.Load("http://$iLOAddress/xmldata?item=All")
	($xml.RIMP.HSI.NICS.NIC | ? {$_.PORT -eq '1'}).MACADDR
}

function Get-NIC1MAC_CPQLOCFG
{
	param
	(
		[string]$iLOAddress,
		[string]$userName,
		[string]$password
	)

	$cpqlocfg = 'C:\Program Files (x86)\HP Lights-Out Configuration Utility\cpqlocfg.exe'
	$gethostdataxml = 'C:\Program Files (x86)\HP Lights-Out Configuration Utility\samples\Get_Host_Data.xml'
	
	$command = "& `"$cpqlocfg`" -s $iLOAddress -u $userName -p `"$password`" -f `"$gethostdataxml`""
	$output = Invoke-Expression $command
	
	$xml = New-Object System.Xml.XmlDocument
	$xml2 = New-Object System.Xml.XmlDocument
	($output -join "`r`n" | Select-String '(?smi)<\?xml version="1.0"\?>\r?\n(\s*(?!<s>)(?!<\?xml version="1.0"\?>)</?[^>]*>\r?\n)*' -AllMatches).Matches | ? { $_.Value -match 'GET_HOST_DATA' } | ForEach-Object {
		$xml2.LoadXml($_.Value)
		if ($xml2.RIBCL.GET_HOST_DATA -ne $null) { $xml = $xml2.Clone() }
	}
	$foundone = $false
	($xml.RIBCL.GET_HOST_DATA.SMBIOS_RECORD | Where-Object {$_.TYPE -eq 209}).FIELD | ForEach-Object {
		if ($_.NAME -eq 'MAC' -and $foundone)
		{
			$_.VALUE
		}
		if ($_.NAME -eq 'Port' -and $_.VALUE -eq '1')
		{
			$foundone = $true
		} else {
			$foundone = $false
		}
	}
	
}

function Get-NIC1MAC {
	param
	(
		[string]$iLOAddress,
		[string]$userName,
		[string]$password,
		[switch]$tryBoth
	)

	if ($tryBoth) {
		Write-Host -ForegroundColor Yellow $iLOAddress [$(Get-iLOVersion -iLOAddress $iLOAddress)]
		Write-Host -ForegroundColor Green 'Trying Get-NIC1MAC_HTTP (iLO 4 and up)...'
	}
	$time = Measure-Command {$output = Get-NIC1MAC_HTTP -iLOAddress $iLOAddress}
	$output
	if ($tryBoth) {
		Write-Host -ForegroundColor Green 'Get-NIC1MAC_HTTP completed in ' -NoNewLine
		Write-Host -ForegroundColor Yellow "$($time.TotalMilliseconds) ms"
		Write-Host -ForegroundColor Green 'Trying Get-NIC1MAC_CPQLOCFG (prior to iLO 4)...'
	}
	if ($tryBoth -or $output -eq $null) {
		$time = Measure-Command {$output = Get-NIC1MAC_CPQLOCFG -iLOAddress $iloAddress -userName $userName -password $password}
		$output
	}
	if ($tryBoth) {
		Write-Host -ForegroundColor Green 'Get-NIC1MAC_CPQLOCFG completed in ' -NoNewLine
		Write-Host -ForegroundColor Yellow "$($time.TotalMilliseconds) ms"
		''
	}
}

if ($iLOAddress -eq '') {
	Write-Host -ForegroundColor Yellow 'Syntax: ' -NoNewLine
	Get-Help Get-NIC1MAC
} else {
	Get-NIC1MAC -iLOAddress $iLOAddress -userName $userName -password $password -tryBoth:$tryBoth
}

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.