Exchange Daily Messaging Report


I was tasked with creating a daily messaging report that would meet the following requirements:

  • Collect essential information about the Exchange 2007 environment
  • Save the data in HTML format
  • Email that report to users

So I created a powershell script that would collect the following information:

  • Mailbox Stats (total #, over quota, over 5GB, etc)
  • Message Stats (number of msg sent/rcd, NDRs, total size, etc)
  • Identify servers who have volumes with less than 20% of free space available
  • Database Information (last full backup, is mounted?, # of mbx, size, etc)
  • Identify if any SMTP queues have more than 50 msgs pending delivery
  • Collect errors from event log, generated during past 24 hours

Once collected, it will send a message with the information as an attached and within the body of the message.

Thanks to http://blogs.technet.com/b/gary/ & http://gsexdev.blogspot.com/ for their contribution

Attached is the script (right click and save target as for proper formatting)

Have fun!

Doug

DailyReport.ps1.txt

Comments (1)

  1. Mark says:

    Great script! Thanks.

    I am getting these errors on the free disk space calculation (I have 4 servers in the servers.txt file):

    Bad numeric constant: 2,605.26.

    At C:psscriptsDailyReport.ps1:132 char:40

    +            $Pfree = "{0:P2}" -f ($free/ <<<< $size)

       + CategoryInfo          : InvalidOperation: (2,605.26:String) [], RuntimeException

       + FullyQualifiedErrorId : BadNumericConstant

    Bad numeric constant: 2,536.23.

    At C:psscriptsDailyReport.ps1:132 char:40

    +            $Pfree = "{0:P2}" -f ($free/ <<<< $size)

       + CategoryInfo          : InvalidOperation: (2,536.23:String) [], RuntimeException

       + FullyQualifiedErrorId : BadNumericConstant

    Bad numeric constant: 2,664.45.

    At C:psscriptsDailyReport.ps1:132 char:40

    +            $Pfree = "{0:P2}" -f ($free/ <<<< $size)

       + CategoryInfo          : InvalidOperation: (2,664.45:String) [], RuntimeException

       + FullyQualifiedErrorId : BadNumericConstant

    Bad numeric constant: 2,936.77.

    At C:psscriptsDailyReport.ps1:132 char:40

    +            $Pfree = "{0:P2}" -f ($free/ <<<< $size)

       + CategoryInfo          : InvalidOperation: (2,936.77:String) [], RuntimeException

       + FullyQualifiedErrorId : BadNumericConstant