Possible to parse through outlook emails?

We have a SEP server that sends out emails to a shared IT email box, this sends out alerts for say ‘attacked computers’.

I would like to write a script that would read the email sent from the alert and determine it’s severity based on the server’s that are affected.

Is there a way to accomplish this with powershell?

I found this from Ed Wilson: https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/26/use-powershell-to-data-mine-your-outlook-inbox/

But it seems to just list the inbox.

I do have access to the exchange management shell as well.

Any tips would be appreciated

It is but it’s easier to use the exchang ews api.

You may want to take a look at EWS (Exchange Web Services). I recently dove into it to replace an old scripted outlook mail rule. I ended up using a variety of sites including good ole MSDN so I dont’ have any specific sites to recommend but I would a quick search on ‘Powershell EWS’. Here’s one link I browsed that gives a short example:



Say I have a subfolder called test under Inbox, using the API, how would I specify a subfolder of inbox?

 $inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox) 

I’ll be honest, I found EWS to have a bit of a learning curve. There may be an easier way (still trying to figure out EWS myself), but you could try:

$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox) 
$folderID = $inbox.FindFolders(10) | Where-Object { $_.DisplayName -eq "Test"} | Select -ExpandProperty ID
$test =  [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,$folderID)