How To Send A Large Number Of Test Messages Through Your Exchange Server Using PowerShell

Leave a comment
Share

There was an interesting question in the Exchange TechNet forum this morning. An admin wanted to send 1000 test messages through their Exchange Server, and they were wondering if there was any third-party application that could do this. Or course, you don’t need any third-party application to do this – you can do it in PowerShell using Send-MailMessage. I’m going to show an example that will send only 100 messages. Put the following text into a file (let’s call it C:\SendMessages.ps1) using Notepad, and then execute it from the Exchange Management Console by navigating to the location (root of C: in this example) and typing .\SendMessages.ps1 .

for($i = 1; $i -le 100; $i ++)
{
Send-MailMessage -smtpserver yourserver -from user@yourdomain.com -to user@yourdomain.com -subject "A test message" -body "A test message"
}

Naturally, you will need to supply a valid server name and valid email addresses in your own domain.





Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>