Automate Exchange Management Shell command
I'd like to put an Exchange Shell command in a batch file that i can run from a scheduler. Does anyone know how to do this? the command is: get-mailboxstatistics -server sbs | select displayname,@{n="size(MB)";e={$_.totalitemsize.value.toMB()}} |sort Size -desc |ft -auto thanks. pajoryan123
April 30th, 2010 12:42pm

I'd like to put an Exchange Shell command in a batch file that i can run from a scheduler. Does anyone know how to do this? the command is: get-mailboxstatistics -server sbs | select displayname,@{n="size(MB)";e={$_.totalitemsize.value.toMB()}} |sort Size -desc |ft -auto thanks. pajoryan123 Hi, Put your command in a text file and save it as .ps1 file. It is called Powershell script file. You can then easily run this script from Windows scheduler. Plz have a look into this: How To: Schedule PowerShell Script for an Exchange Task you can easily do it. Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2010 12:59pm

perfect. Thanks.pajoryan123
April 30th, 2010 1:28pm

This script you linked me to is great. one question though. do you know how you can send the file to multiple recipients? I've tried to add more recipients but it fails. thanks,pajoryan123
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2010 5:18pm

This script you linked me to is great. one question though. do you know how you can send the file to multiple recipients? I've tried to add more recipients but it fails. thanks, pajoryan123 Change this $ToAddress = "amit.tank@Domain.com" to $ToAddress = "amit.tank@Domain.com;user2@domain.com" Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
April 30th, 2010 5:24pm

If that doesnt work then try this powershell code: $recpients = @(user1@domain.com","user2@domain.com") $mailhost = "<mail server>" $from = "user@domain" $subj = "Email Subject" $body = "Email body" $SmtpClient = new-object system.net.mail.smtpClient $SmtpClient.Host = $mailhost $mailmessage = New-Object system.net.mail.mailmessage $mailmessage.from = ($from) for each ($recp in $recpients){ $mailmessage.To.add($recp) } $mailmessage.Subject = $subj $mailmessage.Body = $body if ($attach){ $mailattachment = new-object System.Net.Mail.Attachment($attach) $mailmessage.attachments.add($mailattachment) } $smtpclient.Send($mailmessage) } Regards, Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2010 5:36pm

Change this to $ToAddress = amit.tank@Domain.com;user2@domain.com $ToAddress = "amit.tank@Domain.com" I actually had to use a , instead of a ; to seperate mulitple addresses and it worked fine. thanks.pajoryan123
May 4th, 2010 2:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics