none
Exch2k7 spk3 - cmdlet get-mailboxStatistics and send the results by e-mail RRS feed

  • Question

  • Hi,

    in our old server (exch2k3) we were using WMI/VBS to catch some information about the SMTP QUEUE and mailbox also. In the new server I´m using (manually) the command bellow.

    The question is:

    - Is still available the usage of WMI/VBS in exch2k7?

    - Is there a way to automate that statistics other than using PowerShell/script?

    - Is possible to send the results from cmdlet by e-mail?

     

    get-mailboxstatistics -identity SPAM | ft ItemCount



    tks, Renato P
    Wednesday, October 19, 2011 12:12 PM

Answers

  • Try change the $body as below

    $body = (get-mailboxstatistics -identity SPAM).ItemCount


    • Edited by shuen100 Thursday, October 20, 2011 6:49 AM
    • Marked as answer by jr3151006 Thursday, October 20, 2011 11:55 AM
    Thursday, October 20, 2011 6:48 AM

All replies

  • I found some scripts (example below), the e-mail is sent but the content/body is shown as:

     

    Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands.Internal.Format.FormatEndData

     

     

     

    ########

    Script sample

    ########

     

    $emailFrom = “noc@xyz.com.br”

    $emailTo = “renato.pereira@xyz.com.br”

    $subject = “Mailbox SPAM”

    $body = get-mailboxstatistics -identity SPAM -server MAILSERVER | ft ItemCount

    $smtpServer = “farol.xyz.com.br”

    $smtp = new-object Net.Mail.SmtpClient($smtpServer)

    $credentials=new-object system.net.networkcredential(”spam”,”password”)

    $smtp.credentials=$credentials.getcredential($smtpserver,25,"basic”)

    $smtp.Send($emailFrom, $emailTo, $subject, $body)


    tks, Renato P
    Wednesday, October 19, 2011 1:01 PM
  • Try change the $body as below

    $body = (get-mailboxstatistics -identity SPAM).ItemCount


    • Edited by shuen100 Thursday, October 20, 2011 6:49 AM
    • Marked as answer by jr3151006 Thursday, October 20, 2011 11:55 AM
    Thursday, October 20, 2011 6:48 AM
  • Tks shuen100,

     

    worked fine!

     

    * You are my hero!


    tks, Renato P
    Thursday, October 20, 2011 11:56 AM