Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Exchange 2010 powershell While loop script

$
0
0

I'm attempting to write a script that sends large amount of test emails to an account. I would like to use a for while loop for the number of emails I would like to send. I receive the error "send-mailmessage: a positional parameter cannot be found that accepts argument 1. 

Can you please look at my script below and tell me what I'm missing?


$emailSmtpServer = "ohxxxxxxx.corp.local"
$emailFrom = "aaron@mytest.com"
$emailTo = "aaron.@xxxxx.com", " ella.xxxxxs@cxxxxx.com”
$emailSubject = "Testing e-mail"
$emailBody = @"
Here is a message
From your friendly neighborhood IT guy
"@
$i =1

while ($i -gt 10)
do{Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -SmtpServer $emailSmtpServer $i; 
$i++}


Aaron Harris ExchangeSharePointGuy


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>