Author Posts

May 31, 2016 at 1:20 pm

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

May 31, 2016 at 1:26 pm

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

May 31, 2016 at 1:30 pm

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:

http://www.drowningintechnicaldebt.com/GregTate/archive/2015/03/18/using-exchange-web-services-managed-api-in-powershell.aspx

Thanks,
Chris

May 31, 2016 at 1:45 pm

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) 

May 31, 2016 at 2:03 pm

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)

Thanks,
Chris