0

Is it possible to check if an Exchange email account from powershell? I read this post but it's very dated and I've seen many references to sending mail from powershell but none to retrieve mail.

This is a "poor mans" solution to monitoring and somewhat of a synthetic transaction generator.

In short, I want to send an email from powershell and check email from powershell.

awreneau
  • 11
  • 2

1 Answers1

0

Easiest way to retrieve emails from Office 365 is to use the Graph API.

You'll first need to authenticate to it, if this is going to be an automated solution you would need to authenticate as a Application. https://learn.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0&view=graph-rest-1.0

Then you can list emails using this endpoint https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http

And send an email using this endpoint https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http

srw
  • 106
  • 3
  • Thank you. I'll check this out. – awreneau Nov 19 '19 at 12:55
  • After doing some reading this appears to be for O365 instances and not on prem exchange, but for full disclosure I'm from the Linux world and I could be missing the obvious. I'm trying to script this w/ powershell and admittedly, most of PS escapes me. This may be too far a leap for a new comer. – awreneau Nov 19 '19 at 13:54