It is a script that monitors some IPs on the network and after detecting some consecutive communication failures, an email is sent. The email is correctly sending the IPs with communication problems, but I need to include in the email a list or table with the identification of each IP. Can anybody help me? What change should I make to this part of the script?
I tested some changes but I couldn’t correctly format the table with IPs identification.
Part of the script:
$Data = $Status.Values | Where { $_.'Failed Pings' -eq 5 -or ( ($_.'Failed Pings' -ne 0 -and -not ($_.'Failed Pings' % $Alert))) }
If ($Data)
{ $HTML = $Data | Sort Destination,From | ConvertTo-Html -Head $Header -PreContent "<p>O script de monitoracao detectou falhas de conexao<br></p>" | Out-String
$Ref=
"
REFERENCIAS:
IP Identificacao
172.29.186.100 Mguard EDU 172.29.186.101 EDU OP09 PLC 172.29.186.102 EDU OP09 CP343 172.29.186.108 EDU OP10 PLC 172.29.186.115 EDU OP20 PLC 172.29.186.122 EDU OP30 PLC 172.29.186.128 Test1 172.29.186.129 Test2"$Body= "$HTML
$Ref "
Send-MailMessage -To $To -From $From -Subject "Shop Floor Tier 1 - Detectado Problemas de Conexao" -Body $Body -BodyAsHtml -SmtpServer $SMTPServer
Write-Host "Alert Email Sent!`n"
Start-Sleep -Seconds 1
}
Email received: