Exchange Environment Report v1.5.4

It’s been a few weeks since my last update to the Environment report, but since last time I’ve been incrementally fixing a few bugs reported and added a couple of new requested features.

New Features

  • Initial support for /hosting mode installations
  • Support for multiple email recipients with the MailTo parameter, e.g -MailTo "",
  • Support for filtering by server name using a new parameter –ServerFilter. Use this to limit the report to servers with certain characters in the name, e.g. –ServerFilter “NL-*”
  • Support to change whether or not the entire forest is examined with the –ViewEntireForest flag.
  • When sending the report by mail, the report is also shown as the message content, for easy viewing on mobiles.

Bug Fixes

  • Large deleted item total sizes caused an error due to not setting the variable type to long.
  • In Exchange 2003 environments, Back End and Front End roles are not highlighted in the overview section.
  • In some circumstances the formatting of the report is not spaced correctly in the overview section.
  • Shortened the command used as input to schtasks.exe due to it’s maximum character limitations.
  • Non-DAG databases header showed even if no non-DAG databases were present.
  • Archive Mailbox information was no longer showing.

In the next release I’m hoping to add a few more features that have been requested, including integrating some new features written and sent in by readers. In the meantime, as always if you have any problems give me a shout at or in the comments.

Download the new version from the original article here…

40 thoughts on “Exchange Environment Report v1.5.4

  1. Steve,

    Awesome script! Been using for over a year now. Will there be an update to your script for Exchange 2013?

  2. Hi Steve,

    Great work on the script! Worked perfectly for me with minimum amendments. I have one questions;

    How can I change the background colour for the field for the Last successful backup if the successful backup was 3+ days OLD. This would be useful when you have large number of DBs and you can quickly scan as opposite rad each date.



  3. Hi Steve-

    On line 534, I added $($Server.Edition) to the end just inside the quote. I think it would be helpful for everyone to have when license true-up comes around.

    Here’s my complete line 534:

    $($ExVersionStrings[“$($Server.ExchangeMajorVersion).$($Server.ExchangeSPLevel)”].Long) $($Server.Edition)”

  4. Hi Steve,
    Somehow I’m not able to generate the Non-DAG mailboxes table. I only getting the top summary (the green table) and the site data (blue table) but nothing else.
    I’m on EX 2010 SP2 with 3 servers (Edge/CAS/MB), no DAGS – just 2 databases, the second DB is a Pub folder and 49 mailboxes.
    My PS is v2 and I’m using your script v1.5.4
    Any ideas?

  5. Hi Steve, I’m executing the script from a mailbox role server, which holds Public Folder replica’s. The live Exchange environment is hosted on 4 Cas/Hub servers and a DAG with 6 mailbox role servers in the same site (Ex2010 SP2 rollup1). I’m a local admin on this machine and have Exchange Organization admin permissions. The powershell command runs OK, untill the output file is created. I get this error:

    [PS] C:\Windows\system32>D:\scripts\Export-exchange-stats\Get-ExchangeEnvironmentReport.ps1

    cmdlet Get-ExchangeEnvironmentReport.ps1 at command pipeline position 1
    Supply values for the following parameters:
    (Type !? for Help.)
    HTMLReport: D:\scripts\Export-exchange-stats
    WARNING: Active Directory server settings remained unchanged.
    Out-File : Access to the path ‘D:\scripts\Export-exchange-stats’ is denied.
    At D:\scripts\Export-exchange-stats\Get-ExchangeEnvironmentReport.ps1:974 char:19
    + $Output | Out-File <<<< $HTMLReport
    + CategoryInfo : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

    What's going wrong here?

    • At the HTMLReport prompt all you have to do is type the name you want for the report.

      HTMLReport: Report.html

      • BTW, it is going to save it at the current location at the prompt (C:\Windows\system32). It would be better if you navigated first to a folder where you have write-read permissions first.

    • To echo Edwin, you need to specify parameters, and you’d be best changing directory first. Check out the link in the article that goes to the original Exchange Environment Report post for some examples on usage.


      • Thanks Edwin, I assumed it created the report by only giving the output dir. Report is generated now :-).
        @ Steve, my management was asking for the average mailbox size. The report generates this per Db, so it was easy to calculate the average mailbox size from the total amount of mailboxes. Maybe it’s an idea to add this to the report as well?

  6. Nice job with this script. You just condensed a bunch of scripts I was running separately into one and simple html file ready to display in our portal. Everything works perfectly except for the logs drive space. We use mount points from the SAN into two 1GB partitions, one for logs and one for databases. Database Disks are 550GB and log file Disks are 50GB. The DB disks display and calculate fine but the “Log Disk Free” is picking up the information from the 1GB drive instead of from the mount points.

    This is the original script I use to get all the disks and calculate the space and % for our messaging portal.
    $name = @(get-content X:\computerlistall.txt)
    foreach ($server in $name)
    { Get-WmiObject Win32_volume -filter “DriveType=3″ -computer $server | SELECT-object SystemName, Name,
    @{Name=”capacity(GB)”;Expression={“{0:N1}” -f($_.capacity/1gb)}}, @{Name=”freespace(GB)”;Expression={“{0:N1}” -f($_.freespace/1gb)}},
    @{Name=”free(%)”;Expression={“{0:P1}” -f($_.freespace/$_.capacity)}} | convertto-csv -notypeinformation | add-content dspace.csv}

  7. This report is perfect. I was running all of these same things seperately. Now i just run this and it is even prettied up…


  8. Thank you for this great script, it saved me a lot of work!

    Every time I’m running your script using the parameter –ServerFilter I get a mailbox count of zero. I looked in your script and changed in sections 2.1 every appearance of “Where {$_.Server -like $ServerFilter}” to “Where {$_.Servername -like $ServerFilter}”. Now mailbox counts are correct.
    As we have a pure Exchange 2007 environment, I can’t tell if the problem exists for Exchange 2003 and 2010.

  9. You are an angel in disguise – script is what any Exchange administrator would want to run once a day or week. And a great report for an IT Manager who wants an overall view of the environment “his/her staff” are managing. There are also customers who were technical but have moved into service management and a good report for them. Looking forward to future releases!!!

  10. Dear Steve,

    Get-ExchangeEnvironmentReport Version 1.5.4
    The script is excellent as i can see the example screenshot on your site, Great Job i try to execute the script in my production exchange 2007 SP2 environment but i get the below error. Can you help me to execute the script successfully
    [PS] C:\Report>.\Get-ExchangeEnvironmentReport -HTMLReport c:\report.html
    Incomplete ‘finally’ statement. A finally statement requires a body.
    At C:\Report\Get-ExchangeEnvironmentReport.ps1:44 char:9
    + Finally, <<<

    Abdul Razzak

  11. I had plenty of issues with this not detecting hosted environment’s mailbox counts (mailboxes identities are invisible to those outside the organization)

    My quick and dirty fixes were:-
    function _GetDB:-
    Line 245 — $MailboxCount+=([array]($Mailboxes | Where {$_.Database -eq $Database.Name})).Count
    Line 245 ++ (Get-MailboxDatabase -Server $ExchangeServer.Name | ForEach-Object {$MailboxCount+=(Get-Mailbox -Database $_.Name).Count})

    function _GetDB:-
    Line 214 — MailboxCount = [long]([array]($Mailboxes | Where {$_.Database -eq $Database.Identity})).Count
    Line 214 ++ MailboxCount = (Get-Mailbox -Database $Database.Name).Count

    I’m shoehorning in the results from Get-Organization | ForEach { Get-Mailbox -Organization $_.Name | (Get-Mailbox -Organization $_).Count} to complete the report for our purposes…

  12. Dear Steve,

    is it possible to run the script online for a list of selected servers from a domain?

    Thanks in advance,

  13. Hey Steve,

    I just started using this in my environment (about 2500 users) and it has almost every peice of data I report on separately except one. What do you think about adding in the db location? By that I mean I use a script to verify that each DB is lated in its active preference location…And if not it tells me where it is located. (basically to ensure we didnt miss an automatic failover)

    This script is already everything I could have asked for and more. Really appreciate the dedication to the community. Especially userful for a newbie exchange admin like myself!

  14. Hi Steve,

    I just wanted to try the latest version of your script. However, I get a strange error.

    Incomplete ‘finally’ statement. A finally statement requires a body….

    Did any one run into this?

  15. Just poped back in to see if there were any updates and you have not failed to disappoint!

    I was having a few issues with scheduling, but all good now. Here’s the setup if others are in the same scenario.

    Action = Start a program

    Program = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    Arguments = -command “. ‘C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; C:\Exchange_EnvironmentReport.ps1 -HTMLReport c:\ExchReport.html -SendMail:$true,”

    Thanks again for a great script.


  16. I do get a vastly different number. For example, on our smallest 2003 store, we have 22 mailboxes. The EER shows Av. Mailbox Size to be 1.25 MB, and when I look in the 2003 ESM and average them out manually with a calculator, it comes to 1.60 GB per mailbox. This is a ~99 GB database with about ~62GB free (we are in transition). The EER report shows it is a 92.5 GB database with 92.22 GB free.

    On a different store with more, and larger mailboxes, it shows the average as only .84 MB. We have a toal of 14 stores, and all of them show up wacky in the report in terms of avg size and DB whitespace.

  17. Excellent update Steve. Thanks for all the effort.

    I am still having issues with the math on the 2003 boxen. The average mailbox size and DB whitespace are way out of whack. Trying to figure out if I have something askew, or if the script is computing it wrong. I have to lean towards my own junk though or everyone else would likely have the same issue. Is anyone else reporting bogus math on those two columns?

    • Hi Jaymz,

      The next update will have changes to the whitespace calculation for 2007 and earlier, which is at best an estimate. The average mailbox size *should* be correct as it is calculated by getting all mailbox sizes and working out the mean average. Do you get a different number if you work it out for yourself?


  18. Pingback: Generate Exchange Environment Reports using Powershell

Comments are closed.