This script fetches emails from a given monitoring mailbox by searching email messages for a given subject string. In this case email messages sent by the ENow Management Suite (http://enowsoftware.com/). Status messages are parsed to extract Disk Performance alert data for further processing in Power BI.
The mailbox is queried using Exchange Web Services (EWS). The EWS endpoint is identified by AutoDiscover.
The script exports the following columns for further processing:
You can easily adjust the script to fit your requirements. Search for other message subjects and parse for other content in the message body.
Code Samples
# Run script using default parameters .\Get-EmailContent.ps1
"COMPUTER";"DATE";"TIME";"IO";"THRESHOLD";"VALUE" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"109,90" "EXLABP08";"19.05.2017";"11:15:38";"WRITE";"Warning";"23,61" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"80,13" "EXLABP08";"19.05.2017";"11:15:38";"WRITE";"Warning";"21,58" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"33,01" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"53,04" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"24,24" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"40,01"
This example shows that P04 and P08 have exceeded the critical and warning state disk performance thresholds more often than the other servers.
The next example shows the same date in a different report.