Servers - General
1823908 Members
3221 Online
109666 Solutions
New Discussion

Need a powershell script to collect unrepaired events in ILO5 IML

 
Chris_Coates
Advisor

Need a powershell script to collect unrepaired events in ILO5 IML

I have a few hundred DL/BL/SY servers all with ILO5.  I want to run a PS script that will give me a listing of all IML events that show as not repaired. Does anyone have something like that?

THANKS!

2 REPLIES 2
Kashyap02
HPE Pro

Re: Need a powershell script to collect unrepaired events in ILO5 IML

Hi

You can retrieve this information from RESTApi tool. I used postman and used the below methods.

 


Get method.

https://<ILO IP>/redfish/v1/Systems/1/LogServices/IML/Entries?$filter=Oem.Hpe.Severity eq 'Critical'

 


You can use the Severity filters like Critical, Repaired, Caution, Informational.

 

Will this powershell command retrieving the critical messages to a file when run ?

 

Get-HPEiLOIML $con | ConvertTo-Json | Out-File -FilePath "<Filepath>\<Filename>.json" | Where-Object -Property Severity -EQ Critical

 

$con is the object set for the ILO of the server. 

 

Making a connection to ILO. 

 

$con = Connect-HPEiLO -IP <ILO IP> -Username <ILO Username> -Password <ILO Password> -DisableCertificateAuthentication

 

I am a HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

Accept or Kudo

Marcsmith
Frequent Visitor

Re: Need a powershell script to collect unrepaired events in ILO5 IML

Sure, here's a PowerShell script that should help you collect unrepaired IML events on your ILO5 servers:

# Set the variables for the ILO5 server IP addresses
$server_ips = @("10.0.0.1","10.0.0.2","10.0.0.3")

# Set the variables for the ILO5 login credentials
$username = "username"
$password = "password"

# Iterate through each server IP address and collect the unrepaired IML events
foreach ($server_ip in $server_ips) {
# Create a new ILO5 session
$session = New-HPiLOCredential -Host $server_ip -Username $username -Password $password

# Get the IML log entries
$iml = Get-HPiLOIMLLog -Connection $session

# Filter for unrepaired events
$unrepaired_iml = $iml | Where-Object { $_.RepairState -ne "Repaired" }

# Output the results for the current server
Write-Host "Unrepaired IML events for $server_ip:"
$unrepaired_iml
}

You'll need to replace the $server_ips, $username, and $password variables with your own server IP addresses and login credentials. The script will then iterate through each server IP address and collect the unrepaired IML events using the ILO5 PowerShell cmdlets. The results will be output for each server in the console.