HP Scripting Tools for Windows PowerShell User Guide: OA cmdlets

$sevcnts | Format-Table
}
Disconnect-HPOA $conObj
This script again uses the Find-HPOA cmdlet to locate OAs. It adds username and password and
then connects to the OAs. The Get-HPOASysLog cmdlet is used with the -Target parameter
set to iLO and the -Bay parameter set to 4. This gets the iLO logs from Bay 4 in the two OAs found.
(You may notice that this code is very similar to log processing code in the HP Scripting Tools for
Windows PowerShell User Guide iLO Cmdlets.) The Disconnect-HPOA cmdlet disconnects from
the OAs that were connected to earlier.
Script output:
Warning : It might take a while to search all the HP OA servers if the input is a
very large range. Use Verbose for more information.
VERBOSE: Using 3 threads for search
VERBOSE: Pinging 192.168.242.63
VERBOSE: Pinging 192.168.242.64
VERBOSE: Pinging 192.168.242.65
VERBOSE: No system responds at 192.168.242.65
192.168.242.63 OA has 150 Bay 4 iLO log entries.
There are 2 type(s) of events in the iLO log in Bay 4.
Count Name
----- ----
109 Informational
41 Caution
192.168.242.64 OA has 245 Bay 4 iLO log entries.
There are 2 type(s) of events in the iLO log in Bay 4.
Count Name
----- ----
231 Informational
14 Caution
From this output you can see that there are many Informational messages that you might want to
ignore. However, you might want to view the Caution messages. There are no Critical messages.
The preceding script can be modified to view the Integrated Management Log (IML). This can easily
be done with a few code changes. The following is the modified script.
PowerShell script:
#Find the OAs that I want
$OAS = Find-HPOA 192.168.242.63-65 -Verbose |
% {Add-Member -PassThru -InputObject $_ Username Administrator}|
% {Add-Member -PassThru -InputObject $_ Password Admin}
#Connect to the OAs
$conObj = $OAS | Connect-HPOA
#Get the server information for the logs I am looking at
$serv = $conObj | Get-HPOAServerInfo -Bay All
#get the Server Integrated Management Log (IML) from all Bays
$rt = $conObj | Get-HPOASysLog -Target Server -Bay All
#process the IML entries returned from each OA from the iLOs in All Bays
for ($s = 0; $s -lt $rt.Count; $s++) {
$ilo = $rt[$s]
$sysinfo = $serv[$s]
for ($b = 0; $b -lt $ilo.Bay.Count; $b++) {
#Check to see if a string is returned (which is not log information)
if ($ilo.Bay[$b].Syslog.GetType().Name -ne "String") {
"Bay $($b+1) contains a $($sysinfo.ServerBlade[$b].Manufacturer)
$($sysinfo.ServerBlade[$b].ProductName) $($sysinfo.ServerBlade[$b].Type)."
"The OA at " + $ilo.IP + " retrieved " + $ilo.Bay[$b].Syslog.Count +
" IML log entries from Bay $($b+1)."
$sevs = $(foreach ($event in $ilo.Bay[$b].Syslog) {$event.SEVERITY})
$uniqsev = $($sevs | Sort-Object | Get-Unique)
18 HP Scripting Tools for Windows PowerShell cmdlets