Home » Exchange Server » Get-MailboxReport.ps1 – PowerShell Script to Generate Mailbox Reports

Get-MailboxReport.ps1 – PowerShell Script to Generate Mailbox Reports

One of the Exchange Server administration tasks I perform almost every day is creating mailbox size reports. There are a few different reasons that I create these reports, such as planning a mailbox migration project, responding to a storage capacity alert for a particular database, or providing a specific team of people with a report of their mailbox sizes.

Now it is pretty easy to get the sizes for Exchange mailboxes and to handle the formatting of the Exchange 2010 mailbox statistics so that they are easier to perform calculations on, but it gets a bit boring running those commands day after day.

Even worse, after running the commands to create a CSV report I still had to open that in Excel, remove the unwanted details, use Excel formulas to convert the values from bytes to megabytes, sort them into order, and so on. Again not difficult, just boring after doing it hundreds of times.

So I created a PowerShell script, Get-MailboxReport.ps1, to do all of the heavy lifting for me, and I’m sharing that script with you here.

This script is available on the TechNet Script Gallery or Github. Comments are welcome below. If you find a bug please consider raising it as an issue on Github.

Let’s take a look at how the script works. Here is a video to demonstrate:

I’ve included help information within the script itself so you can use Get-Help to discover how to run the script.

Depending on which parameter you use the output will vary.

  • If you use the -mailbox parameter to query a single mailbox, then the output will appear in the console window. I don’t really see the need to output a single mailbox’s details to a CSV file.
  • If you use any of the other parameters, -server, -database, -file, or -all, the output will be written to a CSV file in the same folder you’re running the script from.
  • You can use the optional -filename parameter to specify your own output file name

Once you’ve generated the CSV report you can open it with Excel and begin to analyze the data.

This script is available on the TechNet Script Gallery or Github. Comments are welcome below. If you find a bug please consider raising it as an issue on Github.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server


  1. Devang Patel says:

    This is Awsome. I tried it and works smoothly. Before using this scripte i used to get the results manually by just entering the commands every time.

    I have one query about the text file that we need to create for getting the results for particular users. which fileds should i enter in the text file.


      • Yogish Acharya says:

        Hi Paul,

        I have one query on quota limit set as a default on those mailboxes where the actual mailbox quota limit value need to fetch from database. for example, If the MBProhibitSendReceive quota set on database is 1GB, mailboxes related to this database should show the report as 1GB ,in fact we are getting the report as unlimited. So i need a powershell command for the mailboxes, where it shows actual quota limit set on database along with other attributes of mailboxes. and one more thing on the same list, some mailboxes quota size not set as default value, it should fetch the exact value on same report. Hope you could understand my query. Please do the needful, would be a grateful to you. Thanks in advance

  2. Sorin says:

    Hi Paul,

    Can u make this script work with server parameter? So it can list all the mailboxes from the server at once.


  3. Chris says:

    Hi Paul,

    That script very useful, very well documented as well. I’ll try to improve it adding if the user has mailbox default storage limits.

    Thanks for sharing!

  4. kevin says:


    I have an issue where the powershel is preventing my from runnin gthe script. ” the file is not digitally signed” is the complaint from the PS!!

  5. Josh says:

    Keep getting an error ….
    “Missing opening “(” after keyword ‘for’.
    At C:Scriptsget-mailboxreport.ps1:48 char:5
    + For m <<<< ore script details, a video demo, or to give feedback please go to:

    Am I missing something?
    Exch 2007

    • Hi Josh, it is written for PowerShell v2.0. Try running:


      …to see which version you’ve got. If you’re on version1.0 you can try and edit the script to remove all that help info at the start, and see if that works, but I haven’t specifically tested it on v1.0 to check for any other issues.

  6. Kerry says:

    Excellent script! Thanks for the work and the updates. I know that this will be used much by myself and the consultants I work with.

    Thanks again

  7. Frank says:

    Getting this error message.

    [PS] C:tempExchangePowerShellother>.Get-MailboxReport.ps1 -database MBX1VPMbxDb-YNHH-002

    Security Warning
    Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
    computer. Do you want to run C:tempExchangePowerShellotherGet-MailboxReport.ps1?
    [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): R
    Cannot process argument transformation on parameter ‘Database’. Cannot convert value “MBX1VPMbxDb-YNHH-002” to type “M
    icrosoft.Exchange.Configuration.Tasks.DatabaseIdParameter”. Error: “‘MBX1VPMbxDb-YNHH-002’ is not a valid value for th
    e identity.
    Parameter name: Identity”
    + CategoryInfo : InvalidData: (:) [Get-Mailbox], ParameterBindin…mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-Mailbox

  8. Frank says:

    Never mind. Got it now. Still getting this message:

    Security Warning
    Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
    computer. Do you want to run C:tempExchangePowerShellotherGet-MailboxReport.ps1?
    [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): R

    I ran Set-ExecutionPolicy Unrestricted

  9. Jeff Strubberg says:


    Great script! I removed a few of the output fields (we only have one mail server and one mail database, so those fields weren’t meaningful for us). At the moment I am trying to sort the resulting csv file via the script to put the mailboxes in order largest to smallest. Could use some help getting this to work.

    Once I’ve got that figured out, this script is going to save me a ton of time. I’ve got it running as a schedlued task on my exchange server and emailing me the resulting csv on the first of every month.

  10. starchaser says:

    I am trying to run this script using the -database or -file parameter and it’s generating a blank csv file. The csv file generated is of 0 bytes.

    • That will happen if no mailbox info could be retrieved.

      For -database make sure you’re supplying a value that would work if you ran “Get-Mailbox -database “.

      For -file try removing the -ignoredefaultscope switch from the script line

      “if($file) { $mailboxes = @(Get-Content $file | Get-Mailbox -resultsize unlimited -IgnoreDefaultScope) }”

  11. starchaser says:

    Well, I tested the -database parameter works with .GetMailboxReport.ps1 -database ‘ServerNameStorageGroupNameDataabaseName’

    However, .GetMailboxReport.ps1 -file does not work. I tried Display Name, Primary SMTP address, UPN but it doesn’t work. It creates a blank 9 byte csv file.

    • Ah yep, see comment above. Try removing -ignoredefaultscope from the line:

      “if($file) { $mailboxes = @(Get-Content $file | Get-Mailbox -resultsize unlimited -IgnoreDefaultScope) }”

      I’ll add it to my bug list.

  12. David Taig says:

    Hi Paul,

    Great report for Migrations. As I need the Alias to perform the migration, I have added this in the first column:

    $userObj | Add-Member NoteProperty -Name “Alias” -Value $mb.Alias

    I also added sort “Size (Mb)” -Desc

    I did run this on a combined DC and Exchange 2007 SP3 Server – Enabled and Expires is blank. OK on other Exchange 2007 SP3 Server, so seems issue having DC and Exchange 2007 together..

  13. turbomcp says:

    Thanks again paul for an amazing time saver(and also teaches me powershell)
    i only had one issue when i ran it through 2010 ps(dont know if it matters) using -file
    i got cannot move something about distinguage name cannot be used or must be used:) when using -ignorescope
    so i removed the ignorescope for the file part of the script and it ran like a charmer:)
    Thanks again
    Much appreciated

  14. Kbart2000 says:

    Hello Paul,

    Thanks again för sharing your script. Works great, I just have a question… How can I do to find the right character in the csv file .. I m having in my exchange swedish names with those: å,ä,ö.

    Is it a parameter to add ?

  15. Christa Wilson says:

    Nice report. I’d like to put it into a scheduled task for a weekly/monthly report that’s emailed to me. I’m wondering how to call upon the output file as it will change each time it’s ran.

    • Hi Christa, probably two ways you could do that.

      1) Remove the file name randomization. So instead of

      $reportfile = “MailboxReport-$timestamp-$random.csv”

      have simply

      $reportfile = “MailboxReport.csv”

      2) The file name is stored as $reportfile, so if you’re adding email functionality to the script you can always reference the file name by that variable, no matter what the real name is.

    • I’ve added a -filename optional parameter to the latest version (1.1) for those who wish to specify the file name instead of the randomly generated ones (actually I use -filename almost every time I run it now :))

  16. Tom G says:

    I guess I am a retard because I can’t get it to run. I keep getting the following error:

    [PS] C:Windowssystem32>c:scriptsget-Mailboxreport.ps1
    The term ‘c:scriptsget-Mailboxreport.ps1’ is not recognized as the name of a cmdlet, function, script file…..

    What am I doing wrong? I am not an expert with PowerShell but this shouldn’t be this hard. thanks

    • Hi Tom,

      Navigate to the folder where you’ve saved the script file, then run it with:


      You’ll need to supply one of the parameters for which type of report you want to run. You can see the help info by running:

      Get-Help .Get-MailboxReport.ps1

      Or watch the video above for a demonstration.

      Hope that helps.

  17. Tom G says:

    I had already tried it that way but I ran it again. See below. I get the same error. It doesn’t seem to matter how I run it. Can you help further? This is driving me nuts. I will watch the video as well.

    [PS] C:scripts>.Get-MailboxReport.ps1
    The term ‘.Get-MailboxReport.ps1’ is not recognized as the name of a cmdlet, function, script file,…….


  18. Allen J says:

    Great script, but I am seeing something odd when I use the -server parameter. The number of mailbox objects listed in the EMC is 2498, but when I use the -server parameter it only processes about 1400 or so, not the full 2498. To get around that for now, I am using a generated user.txt file and using the -file parameter. Any ideas why the difference ?

  19. HotFix says:

    FYI I wrote a similar in concept script to generate Exchange 2010 mailbox billing reports in Excel directly. While it is a slightly different focus than what you are doing (in that it grabs all customer mailboxes or specific OUs, not databases or servers), perhaps you could recycle the Execl logic in my script to dump your data directly into Excel spreadsheet where you have already pre-formatted the attributes the way you want (which we also had to do) and save yourself a step or two:

    I hope it helps.

  20. Shane Bryan says:

    Thanks for the great script Paul. I’ve removed a few of the objects I don’t need, and plan to schedule this to be exported to a SQL server so we can import the results into a database and report on mailbox growth per user.

    I’ve changed your script to remove the random number being added to the file name, but if you can give me some advice on how to alter the export location that would be fantastic as i’d like the file exported to a folder that will have everything in it xcopied to another location at set times.

    Eg: C:ExchangeReportExport

    Cheers from Aus, and thanks again Shane.

  21. Carlos V says:

    Thank you for providing us this script, I run it fine from PS command but when I try to run it on a batch file it doesn’t fetch anything. Can you please help with the line to run it on a batch file?

    powershell.exe -noexit c:TempGet-MailboxReport.ps1 -all

    I get
    Collecting mailbox list
    Collecting report data
    No mailboxes were found matching that criteria.

  22. Zubeir says:

    Getting output below when running the scripts
    Collecting mailbox list
    Collecting report data
    No mailboxes were found matching that criteria.

  23. Carlos V says:

    It’s working now in the batch file, I just added the command to load Exchange Management Shell in the PS script.


  24. ShaunH says:

    I have added to following values to show the Storage quotas as well

    $userObj | Add-Member NoteProperty -Name “IssueWarningQuota” -Value $mb.IssueWarningQuota.Value.ToMB()
    $userObj | Add-Member NoteProperty -Name “ProhibitSendQuota” -Value $mb.ProhibitSendQuota.Value.ToMB()
    $userObj | Add-Member NoteProperty -Name “ProhibitSendReceiveQuota” -Value $mb.ProhibitSendReceiveQuota.Value.ToMB()

    • BR Thurr says:

      I have added these as well:

      $userObj | Add-Member NoteProperty -Name “Primary SMTP Address” -Value $mb.PrimarySMTPAddress
      $userObj | Add-Member NoteProperty -Name “Forwarding Address” -Value $mb.ForwardingAddress
      $userObj | Add-Member NoteProperty -Name “Hidden From Address Lists” -Value $mb.HiddenFromAddressListsEnabled

      Make sure that in your “Select=-Object” line (154 in the latest version), that you add these attributes into your select statement. For example:

      $stats = $mb | Get-MailboxStatistics | Select-Object TotalItemSize,TotalDeletedItemSize,ItemCount,LastLogonTime,LastLoggedOnUserAccount,HiddenFromAddressListsEnabled,ForwardingAddress,PrimarySMTPAddress

    • BKK-Mac says:

      Hi ShaunH,

      I have added those lines to get storage quota and if I run the script against 1 mailbox, I can see those values but when I run against a database, those values are missing from the export CSV file.

      I have also added the values of BR Thurr and they are present in the CSV

      Any idea?


      • Driguez says:


        did you get this solved eventually? I`m also having this issue with the script. Can only display it for one user but not for all in Mb.

        • NK says:

          The issue is the Value.ToMB() setting as when it encounters a mailbox which has no value set this is returned as “Unlimited” which can’t be converted to MB and it causes it to fail.

          I got round that by setting up a conditional statement to test if the quota returns a value and attached to a variable and then calling that variable

          $ProhibitSendReceiveQuota = if($mb.ProhibitSendReceiveQuota.value){$mb.ProhibitSendReceiveQuota.value.ToMB()} else {“unlimited”}
          $ProhibitSendQuota = if($mb.ProhibitSendQuota.value) {$mb.ProhibitSendQuota.value.ToMB()} else {“unlimited”}
          $IssueWarningQuota = if($mb.IssueWarningQuota.value) {$mb.IssueWarningQuota.value.ToMB()} else {“unlimited”}

          $userObj | Add-Member NoteProperty -Name “MBIssueWarning” -Value $IssueWarningQuota
          $userObj | Add-Member NoteProperty -Name “MBProhibitSend” -Value $ProhibitSendQuota
          $userObj | Add-Member NoteProperty -Name “MBProhibitSendReceive” -Value $ProhibitSendReceiveQuota

    • BR Thurr says:


      Go to line 75, and add this line underneath:
      [Parameter(ParameterSetName=’room’)] [switch]$room,
      Go to line 139, and add this underneath:
      if($room) { $mailboxes = @(Get-Mailbox $mailbox -RecipientTypeDetails RoomMailbox ) }

      Save it and run it with the -room parameter. I tested this and it works.

      • Tim says:

        Thanks BR – put doesnt the switch (-mailbox, -database -server, etc) specify where to pull the mailbox information from? Therefore using ‘-room’ switch it would have to be followed by the actual room ? I am trying to pull all rooms from a database or server.

        Unless I am missing something. Thanks again !

    • The mailbox type us already included in the report, so you could just run it without modifications and use Excel to filter the data afterwards.

      Another way would be to generate the list of room mailboxes into a text file and use the -file parameter when running the script.

      Or, yet another way, make a copy of the script and call it say “Get-RoomMailboxReport.ps1” and as BR suggests above change all the Get-Mailbox commands to add the “-RecipientTypeDetails RoomMailbox” parameter.

  25. Dan says:

    If you are getting the “No mailboxes were found matching that criteria.” message, make sure you are running the script in the Exchange Management Shell, this fixed it for me on Exchange 2007 and 2010.

  26. Rajkumar says:

    Hi Paul,

    I have added one Ps1 file which is callinghaving one function. I’m able to run the function( ex: get-Mail….). All is well.
    Can you help me to know, how to remove the Ps1 file and the function Get-Mail… in my exchange server environment. I don’t want others to run this shell command, whenever i need the details, i ll run the script and get the data.
    Help me to remove the function and PS1 file in safe manner

  27. Michael Boback says:

    Awesome script. Can you add functionality to show whether Exchange Archiving is enabled and the Total Size and Total Items in the archive? So far it seems the best way to check if archiving is enabled is to use Get-Mailbox | Select-Object ArchiveDatabase. Someone please correct me if I am wrong though. A value of null means archiving is disabled. I added some lines to the script and this worked.

    When I tried to use Get-MailboxStatistics -Archive | Select-Object TotalItemSize,ItemCount this seems to work, but if the mailbox doesn’t have archiving enabled it throws out an error. I’m new to powershell scripting so I don’t know the best way to add this to the script so it’s handled gracefully.


  28. Alex Edwards says:

    I do not normally post comments on any website, but I just felt I had to this time!
    Thank you – you have made my job about a milliontimes easier with this script…and such a simple thing it is too when you delve into it.

    Why I had not thought of doing this sort of thing myself before I will never guess…but today, yes today Paul, you have made a new friend for life!

    Once again, thank you mate!

  29. Kalvin says:

    I am not familiar with Exchange. When I run the script I get these error:
    Can you help me find the missing links?
    PS C:Mailboxes> .Get-MailboxReport.ps1 -database ‘PWRExchangePWRE_MBX_2-2’
    Get-PSSnapin : No Windows PowerShell snap-ins matching the pattern ‘Microsoft.E
    xchange.Management.PowerShell.Admin’ were found. Check the pattern and then try
    the command again.
    At C:MailboxesGet-MailboxReport.ps1:89 char:27
    + $2007snapin = Get-PSSnapin <<<< -Name Microsoft.Exchange.Management.PowerShe
    + CategoryInfo : InvalidArgument: (Microsoft.Excha…owerShell.Ad
    min:String) [Get-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.G

    Get-PSSnapin : No Windows PowerShell snap-ins matching the pattern 'Microsoft.E
    xchange.Management.PowerShell.E2010' were found. Check the pattern and then try
    the command again.
    At C:MailboxesGet-MailboxReport.ps1:96 char:28
    + $2010snapin = Get-PSSnapin <<<< -Name Microsoft.Exchange.Management.Powe
    + CategoryInfo : InvalidArgument: (Microsoft.Excha…owerShell.E2
    010:String) [Get-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.G

    Import-Module : The specified module 'ActiveDirectory' was not loaded because n
    o valid module file was found in any module directory.
    At C:MailboxesGet-MailboxReport.ps1:124 char:14
    + Import-Module <<<< ActiveDirectory
    + CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [I

    Please Help!

  30. HotFix says:

    @Kalvin – it looks like you are running that script from within a regular PowerShell console. You either need to load the Exchange snap-ins into that console, or instead run the Exchange Management Shell version of the PowerShell console (preferably IMHO). The Exchange Management Shell is installed on any computer you install the Exchange Administration tools on.
    Happy hunting!

    • Kalvin says:

      I am actually running it remotely and I am not in Exchange admin group. I have been given readonly access. Does that suffice or I need to do more?

  31. Shane says:

    Kalvin, as HotFix says, you will only be able to run this script either from with in the Exchange Management Shell version of the PowerShell console on an exchange server or from a computer that has the Exchange Administration tools installed onto it.

    You can use the following command to load the Exchange Management tools in a script though, if that helps or you have problems fiding the Exchange console.

    function Load_Exchange_Tools {
    if (-not (Get-pssnapin | ? {$_.name -like ‘Microsoft.Exchange.Management.PowerShell.e2010’})) {
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.e2010

    If you don’t have access to the tools, or your permissions don’t allow access to Exchange, you won’t be able to run scripts like this though.

    Rgds, Shane.

  32. Bjarni Kristjansson says:

    This is brilliant, thanks
    e.s. I changed the export command to $report | Export-Csv -encoding ‘unicode’ -Path $reportfile -NoTypeInformation – because here in Iceland we have alot of strange Icelandic characters like æ á þ ð ó and so on!
    Nice work.
    best regards, Bjarni

  33. Lumir says:

    It seems that code
    #This is an aged mailbox, so we want some extra details about the account
    $user = Get-User $mb
    isn’t exact
    better is
    $user = Get-User $mb.Alias

  34. Animesh says:

    Have you ever considered using a txt or csv file as input? I am currently evaluating Petri’s script for the same and can’t specify an input file. After analyzing your script, I find my problem as it is. Can you suggest me a way where I can specify a TXT or CSV file as input for users?


    • The script has a -file parameter for using a txt file as the list of users to generate the report for. The txt file should contain the list of mailbox users in a format that would work with Get-Mailbox, so that could be alias, email address, display name, etc.

  35. David says:

    Hi thank u a lot for your wonderfull script.
    I need to bublic it to may intranet site. How convert it in html formatted tablereport?

    Could u modify the script to add html export?

    I’m trying to modify it but I’m not able.

    Thank you very much.


  36. Shane Bryan says:

    David, do you have SQL reporting services available to you?

    We take the data from this script and it gets imported into a database for SQL reporting. It allows me to see weekly growth on mailboxes by department and user. I totally recommend that if you have the resources available to you. Perhaps that might be more useful than simply dumping it into a html file, using a database and reporting services will let you track growth, find the heaviest mail users – and if your company is so inclined, charge accordingly.

    Before I found this script we were going to spend a great deal of money on a reporting system that went through the Exchange server logs. This script coupled with SQL reporting has pretty negated that.

    Anyhoo, there IS a ConvertTO-HTML option you can use with PowerShell, this link may help.


    • Ray says:

      Hi Shane,

      how is this done ? I am quite interested in doing this. Could you or any one else shed some more light on it ?


      • Shane Bryan says:

        Hi Ray. I use the script that Paul kindly created with just a couple of slight modifications. My copy of it is here; http://pastebin.com/yVyJdpxh

        One change was the folder where it dumps the csv file. The other change was appending the date to the filename of the csv file to create a history. I take no credit for this, from memory Paul helped me work that out also 🙂

        There is a scheduled task on our Exchange server that runs this script once a week. Another scheduled task then robocopies the csv file to a SQL server that’s running Reporting Services. We then convert the .csv file to a .xls file, cleaning some of the data up. This excel file is then fed into the reporting database and then displays in the report when that is run. I’d past an export of that, but there’s corporate information in it so here’s a snippet of it, with corporate info blurred out.


        The report can be filtered by date, department etc so the majority of the work here was in the quality of the report created by our appsdev person.

        It also drops down to show the users from each department and the size of their mailbox on those dates. It’s shows growth, but also shows when someones doing a mass delete in their mailbox (perhaps a pending resignation etc, so we make a note of this in case we have to restore it from tape at some point).

        So unfortunately my ability to help further is hindered by the fact that the majority of the awesomeness was done by our awesome report writer. They take the data dump from this file and turn it into something useful 🙂

      • Shane Bryan says:

        Hi CRAZY IT guy. It’s a standard INSERT

        First we edit the spreadsheet a bit by changing the date from 020712 to 02/07/2012 which is done manually, then our code to import it is;

        INSERT INTO [ExchangeReporting].[dbo].[MailboxReport]

        select *

        from [ExchangeReporting].[dbo].[MailboxReport-070512]

        Obviously things will change for your environment such as the database name etc, also the file name is changed for each import as well. I hope that helps.

  37. David says:

    Hi Bryan, thank you for your answer.
    I do not have a sql database but only a intranet webs erver where to publish the html report.
    I saw the codee like this:

    $style = “BODY{font-family: Arial; font-size: 10pt;}”
    $style = $style + “TABLE{border: 1px solid black; border-collapse: collapse;}”
    $style = $style + “TH{border: 1px solid black; background: #dddddd; padding: 5px; }”
    $style = $style + “TD{border: 1px solid black; padding: 5px; }”
    $style = $style + “”
    $message.Body = Get-ExchangeServer | Select-Object Name,ServerRole | ConvertTo-Html -Head $style

    Where can i put this code in your script to have the csv to html report file?

    I tried to insert in the following part of your script code but but I did not get the html table file:

    $reportcount = $report.count

    if ($reportcount -eq 0)
    Write-Host -ForegroundColor Yellow “No mailboxes were found matching that criteria.”
    #Output single mailbox report to console, otherwise output to CSV file
    if ($mailbox)
    $report | Format-List
    $report | Export-Csv -Path $reportfile -NoTypeInformation ???–> in this part?
    Write-Host -ForegroundColor White “Report written to $reportfile in current path.”
    Get-Item $reportfile ?? or in this part?

    Thank you so much for you help.


  38. Jon Schlatter says:

    Thank you, this script has been very helpful! I do have one question that on an issue I see when I use it.

    Each time I run it I see a number of errors saying the following. Please note the

    The operation could’nt be performed because object ” couldn’t be found on ”.
    + CategoryInfo :NotSpecified: (:) [Get-User], ManagementObjectNotFoundException
    +FullyQualifiedErrorID: : ,Microsoft.Exchange.Management.RecipentTasks.GetUser

    This happens to users that are in one specific domain (which I can query with no issues in AD Management). Would anyone have any ideas on what I can do to resolve this?

    • Jon Schlatter says:

      Please disregard my previous post. I found the answer to my issue only moments later. I corrected the recipent scope and all is fine.

  39. Aziz says:

    Thanks for your help by providing this Scrip, However I have tried to us is from ( Exchange powershell and Windows Poershell ) and while trying to import it there is an error message :

    [PS] C:Scripts>import-module .Get-Mailboxreport.ps1
    Collecting mailbox list
    Collecting report data
    No mailboxes were found matching that criteria.


  40. Erik says:

    Excellent script, thanks for sharing!

    Works like a charm. One question though. How did you get excel to sort the csv file automatically?


    Hi Paul,

    I want to be run powershell command for Send As permissions in exchange 2010 ….which command should be used normally I am giving manually in exchange 2010 console..can you post Send as permissions command and if you possible share all the basic commands etc..add permissions.. DLG Creation .. and RMB Creations

  42. Shane Bryan says:

    Hi Paul. I notice in the script that the variable $timestamp is used in 2 places?

    $timestamp = Get-Date -UFormat %dd%mm%yy
    $reportfile = “C:PSScriptsCopyMailboxReport-$timestamp.csv”

    this places the timestamp on the file name (which is invaluable)

    and also;

    $userObj | Add-Member NoteProperty -Name “Date” -Value $timestamp

    places the time stamp into the spreadsheet data itself, next to the user name, dept, mailbox size etc.

    in the csv file, the date is displayed as 060712 (when I run it today).

    is it possible, to have the date (in the data, not necessarily the file name – as it won’t like slashes) be in the 06/07/2012 format?

    that might require the creation of a second timestamp variable though just for the date inside the csv file?

    if i change the $timestamp variable to;

    $timestamp = Get-Date -UFormat %dd%mm%yy

    the date on the file, and in the data gets written as; 06d07m12y

    I don’t expect you to solve the worlds problems for us, but is there a link or something you can share that will educate me on how to achieve the date formatting I need?

    Cheers, Shane.

  43. Shane Bryan says:

    Possibly :p It was a while back now. Apologies if I’ve turned your beautiful script into some bastard child :-p

    • Yeah I just don’t see it in the original. Modifications are fine, people should certainly feel free to tweak these scripts to suit their needs.

      So what is the goal of that extra property you’re trying to set? Is it so your SQL import knows which day the stats apply to?

      • Shane Bryan says:

        Hi Paul, yep at present I manually edit the csv file and replace all the 020712 date data with 02/07/2012 manually.

        it doesn’t take long, but the more i can automate the better 🙂

  44. Shane Bryan says:

    Thank you Paul, that did the trick.

    I now have 2 variables.

    $filetimestamp = Get-Date -UFormat %d%m%y
    $datatimestamp = Get-Date -f d

    $filetimestamp is appended to the csv file when it’s written.
    $datatimestamp is used in [$userObj | Add-Member NoteProperty -Name “Date” -Value $datatimestamp] and displays the date as “6/07/2012” inside the csv file

    Perfect! Thank you so much 🙂

  45. Brian says:

    Hi Paul,

    Great Stuff, is it possible to alter the script to display total mailbox size per user, currently it only displays, Item Size and deleted item size.


  46. peter says:

    Hi Paul,
    I ran your script, it worked fine, thank you. I summed the Mailbox and deleted items they added up to 112Gb, but my two edb files are 86Gb and 45Gb, any idea wat is using the extra 20Gb? Db maintenace runs nightly.

  47. narasimha says:

    Can i run ..powershell command as the following requirements.
    1 ) DLG Creation
    2 ) RMB Creation
    3 ) moving mail box from one location to another location ( Database )
    4 ) how to view log if we applied succesfully p-shell commands

  48. david sia says:

    Paul when i run the script I get:

    WARNING: Error initializing default drive: ‘Unable to find a default server with Active Directory Web Services

    but then it looks like it runs…



  49. Alagar says:

    very nice Script, Works perfectly for me with limited count.

    I have 500 mailbox, but i am getting only 139.

    .Get-MailboxReport.ps1 -server Exmbx02 -filename e:allmailbox.csv

    Please advise to get the full mailbox report.


  50. Alagar says:

    By executing the following command it is giving the full report,
    .Get-MailboxReport.ps1 -full -filename e:allmailbox.csv


  51. Ben says:

    Nice script. But i have a question, could you advise on how i can generate a report that will include the “date” a mailbox is disbled. In otherwords, the disabled date for all disabled mailboxes.

    Thank in anticipation.

    • Do you already know how to retrieve the disabled date for a mailbox, and just want to know how to incorporate that into the script? Or are you also asking how/if its possible to retrieve the disabled date itself?

  52. Peter Davidse says:

    I am in Norway and the DisplayName contains ØÆÅ characters that are not in the generated reports, there they are substituted by a questionmark.
    Do you have a fix for that?

  53. Ytsejamer1 says:

    Just wanted to drop a note of thanks for this script. I’ve been cobbling together a couple different reports to get me (and my supervisors) what we need. That was excellent. Cheers!

  54. Peter Davidse says:

    I have an issue with the saved report.
    The first characters of the file are not “normal” characters.
    When using the report in Linux the file is being identified as a assembler file, not a text file.
    How can i fix this in the report generated instead of writing a workaround in my scripting language on the linux machine?

    Cheers, Peter

  55. Ramesh says:

    Excellent One.

    how to get mailbox details which includes the Servername, databasename, username – ,maybe display name etc.

    I gave the command as follow.

    get-mailbox -database dbname -server servername. But getting ambigous error. Can you please help me out in this.

  56. Jesse says:


    Thanks for the great script. I modified the Total Item Size and Deleted Item Size ToGB() because of the size of the mailboxes I am dealing with. I was wondering how I could format the values to 2 decimal place ex 9.65 right now it is displayed as 9. I tried figuring this out on my own but I am a powershell noob.

    Thank you

    • Anything is possible with PowerShell mate 😉

      I would encourage you to look at the script code. Look at how the parameters are defined. Look at how those parameters correspond with the Get-Mailbox commands. You should be able to quickly see how to add that functionality you want.

  57. peter says:

    Hei Paul,

    Is there a way to suppress the first row?
    Aka, only having in data in the file and not the property name on the first line.


  58. Rolando Rodriguez says:


    I’m trying to run the script, however my databases have users from 3 seperate child domains. The report runs through for the local domain where the Exchange servers are hosted, but throws errors about not being found on the Domain Controller. I have a similar issue when I have to do exports and actually define the DC for the other child domain to pull an export. Any way this can be addressed in the script?

    • At about line 130 in the script is the series of Get-Mailbox commands for the various all/server/database scenarios. You can modify those lines to specify a DC if you need to.

      Interesting that you’re having that problem at all. The script is designed to ignore default scope and search the entire forest, so it should find any mailbox regardless of child domains.

      • Rolando Rodriguez says:

        Once it ran against the whole Server, it DID pull me back the info for the mailbox size and item count, but it didn’t pull back the AD info for the mailbox except mailbox user name. At the end, it did what I really needed, so THANK YOU!

  59. Igor says:

    The script is perfect the only thing that would make it even better for me is to include the following: IssueWarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota. Any chance you could do it?

  60. MyITGuy says:

    Hey Paul. Great script outside of a couple minor suggestions.

    If the script requires a specific version of PowerShell; include the following:

    #requires -version 2
    write-host “Can only run on v2.”

    Also, it may be a better choice to use, “Set-ExecutionPolicy RemoteSigned” instead of “Set-ExecutionPolicy Unrestricted”


  61. gnikolic says:

    Hi Paul!
    Thanx for sharing a script. One question. Is there a solution to add another value for get-mailbox with prohibitsendquota option. It would be usefull to get that info with all this usefull info.


  62. maddison says:

    To setup a monthly mailbox report just create a cmd batch file with the following command line in it, then set it as a task on the exchange server to run each month:

    C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command “. ‘C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1’; Connect-ExchangeServer -auto | “C:scriptsGet-MailboxReportMin.ps1 -all

    All the Beast Matt

  63. Ken says:

    Thank you much and great work as always. Anyone know a way to add the Sent Items to the report? TotalSentItemSize to the Select-Object line and $userObj | Add-Member NoteProperty -Name “Sent Item Size (Mb)” -Value $stats.TotalSentItemSize.Value.ToMB() to the PS object. The script runs fine but does not output the Sent Items value.



  64. Kelley says:

    I have customers who have multiple databases for their mailbox. Is there a way to alter the -database paremeter to analyze all databases that begin with a specific set of characters?

    • Kelley says:

      I think I’ve found a way to resolve my issue. I added these lines in the appropriate places in the script:

      [Parameter(ParameterSetName=’CustomAttribute1′)] [String]$CustomAttribute1,

      if($CustomAttribute1){ $mailboxes = @(Get-Mailbox -Resultsize Unlimited | where {$_.CustomAttribute1 -eq $CustomAttribute1} ) }

      This allows me to report on a subset of my users regardless of what database their mailbox is in. It does take a while to gather the matching users before processing but if I schedule this and other variations to run at night it should not put a crunch on the server. I already run nightly scripts to set the proper value for CustomAttribute1 for users.

      This is a really nice script that is well documented and I truly appreciate it.

  65. steve says:


    Great script. I am trying to figure out how to get one more field added, all SMTP addresses (aliases) for all users. How can I accomplish this.

    I typically do the following:Get-Mailbox | Select DisplayName, Alias,PrimarySMTPAddress, @{Name=’EmailAddresses’;Expression={[string]::join(“;”, ($_.EmailAddresses))}}

    I am not sure how to integrate that here.

    Thanks for the help!

  66. John Panicci says:

    Love the script…Is it possible to add Online Archive MB as a column? I’d like to determine the size of each Archive MB as well.

  67. Another Paul says:

    Getting her late to the party but a very awesome script! Great dialog in the thread as well for situation-specific needs!


  68. Arras says:

    Great information on all your posts.
    I’m getting this error:
    WARNING: Error initializing default drive: ‘Unable to find a default server with Active Directory Web Services running.’.

  69. Oleg Tarasov says:

    Hi Paul,

    I have modified your script to give information on online Archive if one is enabled. Insert my code in $userobj section:

    $userObj | Add-Member NoteProperty -Name “Database” -Value $mb.Database
    #========Online Archive code================
    if ($mb.ArchiveDatabase)
    $astats=$mb | Get-MailboxStatistics -Archive
    $userObj | Add-Member NoteProperty -Name “Archive Item Size (Mb)” -Value $astats.TotalItemSize.Value.ToMB()
    $userObj | Add-Member NoteProperty -Name “Archive Deleted Item Size (Mb)” -Value $astats.TotalDeletedItemSize.Value.ToMB()
    $userObj | Add-Member NoteProperty -Name “Archive Items” -Value $astats.ItemCount
    $userObj | Add-Member NoteProperty -Name “Archive Server” -Value $astats.ServerName
    $userObj | Add-Member NoteProperty -Name “Archive Database” -Value $astats.Database
    } else {
    $userObj | Add-Member NoteProperty -Name “Archive Item Size (Mb)” -Value “”
    $userObj | Add-Member NoteProperty -Name “Archive Deleted Item Size (Mb)” -Value “”
    $userObj | Add-Member NoteProperty -Name “Archive Items” -Value “”
    $userObj | Add-Member NoteProperty -Name “Archive Server” -Value “”
    $userObj | Add-Member NoteProperty -Name “Archive Database” -Value “”
    #=====Online Archive code ends==================

    Also to support non-latin characters in your report and to be able to open straight with MS Excel change your export command to
    #========New export code=================
    $report | Export-Csv -Path $reportfile -NoTypeInformation -delimiter “;” -encoding “utf8”
    #========New export code end=================

  70. Trevor says:

    Had some trouble getting this to work. When you typed Get-M it autocompleted the rest for you, It did not do this for me, I tried typing out the whole command but kept getting an error that it could not find the script. I had to type out


    with the . in front before it would run. spent about 10mins before I figured that out…… Sure was much easier when you could open exchange 2003 and it told you how big the mailboxes where in a GUI.

    Good article though, thanks for the help.

  71. Scott says:

    Hi Paul,

    Great script and have been using it for a couple years.

    Over the past couple days I have been getting the following error;

    Parameter cannot be resolved using the specified named parameters. At line:1 char:24

    Any ideas?


    • Have you modified the script or upgraded your version of PowerShell or something like that?

      Note also that some combinations of parameters can’t be used. Eg, you can’t use -Server and -Database together.

        • Shane Bryan says:

          I’m getting this same error now as well.

          No updates on the mail server. No PowerShell upgrades but when I try and run it, I get;

          [PS] C:psscripts>.Get-MailboxReport.ps1
          C:psscriptsGet-MailboxReport.ps1 : Parameter set cannot be resolved using the specified named parameters.
          At line:1 char:24
          + .Get-MailboxReport.ps1 <<<<
          + CategoryInfo : InvalidArgument: (:) [Get-MailboxReport.ps1], ParameterBindingException
          + FullyQualifiedErrorId : AmbiguousParameterSet,Get-MailboxReport.ps1

  72. Justin says:

    This script is great, a real time saver. I do have one question. We have 2 MB servers that are in a DAG. When I run against one I only get about 1/4 of the mailboxes returned. I know they’re all on both as we flip back and forth on mount points when we need to to perform maintenance (and the DB sizes are the same on both). Any idea why only one would return full results and the other incomplete?


    • The -Server parameter for the script isn’t really suited to DAGs. That is probably because when I first wrote it there were no DAGs in the environment I was working in.

      The ServerName on a mailbox that is hosted on a DAG is misleading. I believe it gets stamped with the server name that the database was active on at the time the mailbox was created, but doesn’t update as active databases switchover.

  73. Shane Bryan says:

    thanks Paul. what happened is i have a few scripts set to run automatically via task scheduler, i inadvertently deleted the task that run this one – which had all the parameters so it would run as intended.

    i was trying to run it manually, without those – sorry about that 🙂

    Cheers Shane.

  74. Evan Barrett says:

    Hi Paul.

    First off, GREAT script!

    Is there a way to break down the stats by date range per mailbox? Example:
    Items 0-15 days, Size 0-15 days, Items 16-30 days, Size 16-30 days, etc.?

  75. Todd Nelson says:

    I LOVE THIS SCRIPT! I’ve been using it for a while and it helps me to identify “dead” mailboxes, their sizes, etc. However, I recently ran into an issue that I am unable to figure out.

    If I run the script against my lab environment (or most any other for that matter) with Exchange 2010 SP3, I receive information for all of the headers…

    “DisplayName”,”Title”,”Department”,”Office”,”Enabled”,”Expires”,”Last Mailbox Logon”,”Last Logon By”,”Item Size (KB)”,”Deleted Item Size (KB)”,”Items”,”Type”,”Server”,”Database”

    But, I ran into a situation where two of the headers do not show in the report. And these headers (and info) are quite important to determine our migration strategy. The two headers that do not show are…

    “Item Size (KB)”,”Deleted Item Size (KB)”

    I am running the same command and the same switches (using server name) but the results are different in this particular environment.

    Paul, any ideas why this might be occurring?


  76. Allen says:

    I’ve been successful a few months back in manually running your excellent script but tried again today and nothing happens. No errors but no CSV files appear. Command line looks like this:
    PS C:scripts>”.get-mailboxreport -all” or “.get-mailboxreport” are accepted without any feedback.
    I am running this on the active mailbox server against a DAG in Exchange 2010. I must be missing something really simple! Advice?

    • Todd Nelson says:


      Does the account you are running the script with a member of the “Organization Management” group? I don’t feel the account needs Enterprise Admins membership but may since the script seems to query AD.


      • Allen says:

        My account is a domain admin and a member of the Exchange Organization Administrators. I can try adding myself to the Organization Management group to see if that makes any difference. Will update in a few. Thank you.

  77. Allen says:


    No difference. Here is an example of what I see in the EMS – the command seems to simply echo back but no CSV files or even errors or additional info is generated:
    PS C:scripts> “.get-mailboxdatabase -all”
    .get-mailboxdatabase -all
    PS C:scripts>

    • Allen says:

      Typo – please excuse me. Here is the actual text from the screen ….

      PS C:scripts> “.get-mailboxreport -all”
      .get-mailboxreport -all
      PS C:scripts>


    • Todd Nelson says:

      One thing that I see is very curious. The name of the script referred to in this thread is “Get-MailboxReport.ps1”. Therefore, the command being run should be “.get-mailboxreport -all”. So, I feel this is probably a typo.

      If it is still not running for you, I cannot think of anything else but to make certain the file is unblocked from running and that the report output is being sent to a folder that isn’t set to read-only.

      I am running Exchange 2010 SP3 hosted on WS2008R2SP1 with PowerShell 2.0.

      When I run the command, this is what I see…

      [PS] C:ToolsGet-MailboxReport>.Get-MailboxReport -all
      WARNING: Active Directory server settings remained unchanged.
      Collecting mailbox list
      Collecting report data
      WARNING: The user hasn’t logged on to mailbox ‘red.local/Users/DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB852}’
      (‘5631bcc1-7f67-4600-9fcb-82e652b92d2f’), so there is no data to return. After the user logs on, this warning will no longer appear.
      Report written to MailboxReport-20130509-1346-1rFbV8.csv in current path.

      Directory: C:ToolsGet-MailboxReport

      Mode LastWriteTime Length Name
      —- ————- —— —-
      -a— 5/9/2013 1:46 PM 2594 MailboxReport-20130509-1346-1rFbV8.csv

      [PS] C:ToolsGet-MailboxReport>

    • Todd Nelson says:

      Another thing I could recommend is to download the script again but to a new/different folder on your mailbox server and try to run again.

      • Allen says:

        Thank you very much for all of your replies. Yes, there was a typo that you picked up. I’ve tried running:

        PS C:\> cd scripts
        PS C:scripts> .get-mailboxreport -all
        Collecting mailbox list
        Collecting report data
        No mailboxes were found matching that criteria.

        And tried running:

        PS C:scripts> “.get-mailboxreport -all”
        .get-mailboxreport -all

        And you see the results. Tried another download to another directory with the same results. Permissions are all fine. I am running Exchange 2010 SP1 rollup 8 on Windows Server 2008 R2 Datacenter with SP1 and powershell V1.

        Here’s what I see after a fresh download to the C:Tools directory (newly created directory with permissions rechecked):

        PS C:tools> get-executionpolicy
        PS C:tools> .get-mailboxreport -all

        Security warning
        Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
        computer. Do you want to run C:toolsGet-MailboxReport.ps1?
        [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): R
        Collecting mailbox list
        Collecting report data
        No mailboxes were found matching that criteria.

        Interesting. Different info on the screen this time though.

        Database names in the DAG are DAGDB1 and DAGDB2. Calling them in the -database variable doesn’t change anything either.

        • You need to run it in the Exchange Management Shell or at least a PowerShell window where you’ve loaded the Exchange snapin.

          If you just open plain PowerShell and run it then you get no results, as you’re seeing.

          The next version of the script will account for that and give a more useful error if the snapin can’t be loaded.

  78. Allen says:

    Paul, that was exactly the problem I was having. I was opening the Exchange Management Shell and then typing powershell to bring up the PS> prompt that I was seeing in the video. Running it strictly from the EMS works perfectly.
    Todd and Paul, thanks again for all your help. Great stuff and great script!

  79. BLeonard says:

    Thanks for this script Paul. It works very well, and is a great foundation for learning more PS Exchange scripting techniques.

  80. Jim Zaino says:

    I have a question the spreadsheet that is created with the -all parameter. I am being asked about the items column. What do the numbers in that column relate too.



  81. Sachin Kumar Singh says:

    Hi Paul,

    Thanks a lot for this script.

    I need to use this script with -Server parameter, want to schedule this script to run on specific time and generated .CSV file should automatically sent to desired SMTP address. Your help to configure it.

  82. Dennis Hartmann says:


    phenomenal script! I did, however, run into a weird thing. When I filtered the spreadsheet to display the archives of users it only showed one, versus at least 15-20 people’s archive on my Exchange 2010 SP3 server, Any clue as to why this could display wrong data?

      • Dennis Hartmann says:

        Thanks Paul,

        I simply ran the -all condition to get as much info out of our Exchange environment as possible. We have 4 DBs, 3 with quota on mailbox size and one dedicated as the “Archive DB” with no quota. in addition what your script provides, I’d like to see how my archive DB is growing in size. So far, we only have company executives Archive enabled, fearing the DB would grow out of proportion if it were enabled for all users.

        Again, thanks Paul!


        • I see. What you’re getting then is regular mailboxes that are sitting on your archive DB.

          I’ve got a newer version of the script that does include archive mailbox stats in the results. I’ll tidy it up a bit and release an update soonish 🙂

  83. James Arellano says:

    Hello Paul, this script is a great help…. question, is there any way to incorporate

    “Get-MailboxFolderStatistics –FolderScope Inbox,SentItems,DeletedItems”

    into this reporting script? ive tried but failed with piping.



  84. Manjunatha says:

    Dear Paul, Excellent script 7 thank you for your effort, sharing it freely for public.

    I have a request – Is there a possibility to add a column to fetch email ID in the script?

    • I could add that to a future version, but I really encourage people to feel free to customize the scripts to suit their own needs. It is a good way to learn PowerShell if you are not already experienced with it.

  85. Artie says:


    Thank you for this great script. I am trying to tweak the powershell to get it to show me the StorageLimitStatus but cannot seem to get it to work. I have added Storage LimitStatus to the $stats list (Line 154) and added a new row like the others (Line 179). The heading shows up on my CSV, but I get no data. The two lines as I have them in my code are as follows:

    154: $stats = $mb | Get-MailboxStatistics | Select-Object TotalItemSize,TotalDeletedItemSize,ItemCount,LastLogonTime,LastLoggedOnUserAccount,StorageLimitStatus

    179: $userObj | Add-Member NoteProperty -Name “Limit Status” -Value $mb.StorageLimitStatus

    Any help is greatly appreciated, and thank you again for this great script!

  86. jay says:

    Hi Paul

    Thanks for the great script – works like a charm. Can you point me in the right direction to add two extra columns? I would like to add forwarding address & all other smtp addresses (maybe seperated by a colon or similar). I’ve managed to do this in my own script but it’s fairly primitve and ideally would like to intergrate into your script but I’m not sure how to go about this. Cheers

  87. jay says:

    sorry – should have been clearer with what I was chasing above. i can get the user to where this is forwarding by putting in the following line:

    $userObj | Add-Member NoteProperty -Name “Forwarding Address” -Value $mb.ForwardingAddress

    but ideally I would like to have the actual email smtp address but I don’t know how to get it using the ForwardingSmtpAddress property (seems I need to get this from Get-Mailbox instead of Get-Mailboxstatistics??)

    Also, I can get all the smtp addresses by using:

    $emailaddresses = [string]::Join(“;”,($mb.EmailAddresses | Where-Object {$_.PrefixString -ceq “smtp”})

    which is fine but I’d ideally like to remove the smtp: part from the start of each email address. Maybe I’m just being picky on this one… Thanks.

  88. Tim McCarty says:

    Paul – thanks for this – I am wondering about running this script in very large environments. I am presently working in an environment with over 80,000 mailboxes and the script is taking a very long time to run (in excess of 4 hours) and the working set (RAM) after 4 hours is 7 GB. I am also seeing this error in the console ” Processing data for a remote command failed with the following error message: Objects cannot be added to a closed buffer. Make sure the buffer is open for Add and Insert operations to succeed. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo : OperationStopped: (System.Manageme…pressionSyncJob:PSInvokeExpressionSyncJob) [], PSRe motingTransportException + FullyQualifiedErrorId : JobFailure”

    Anyway the point and my question – have you considered any improvements for the script when working with very large data sets and/or can you point me to any helpful resources for improving the script myself?

    Thank you for your time and attention!

    • In a similarly sized environment (where I developed early versions of that script) I never ran it for the entire organization in one go because yes, it takes forever, and yes, it eats a huge amount of RAM.

      Instead I would run it using the -Server or -Database parameters to just get the specific info I needed.

      Perhaps there are more memory-efficient PowerShell techniques that could be used to handle very large scenarios like that but I haven’t looked into it.

  89. Tim McCarty says:

    Paul – I made some additions / changes to your script – if you would like I would be happy to send it to you for your review / use.

    Thanks again for providing such a stellar script.

    In the interest of full disclosure – i will say that the changes I made do NOT improve the functionality (memory use, etc.) of the script – I mostly have it collecting more data – and added an option for quickly testing in new environments.

    -Thanks again, Tim

  90. Allen says:

    I wonder if it is possible for this script to run for only the users with hidden mailboxes? I’ve tried altering the script and have had no success. I’m trying to find all of the hidden addresses with who has full and/or read permissions to the hidden addresses listed, but I could do the permissions part manually.

  91. Dhillan says:

    Paul – thanks for this wonderful script. I have used it over the past 2 years now on a number of deployments that i have done and clients are really appreciative of this.

    I however have been trying to run the same script on an Exchange 2013 deployment, the script runs fine except that I do not get information on the StorageLimitStatus. My understanding that there has been changes made to the store and Exchange Server 2013 Information Store does not cache the values of mailbox quotas.

    I am not the best at powershell and have seen that there are ways to get around this but have not been successful. Is there a chance that you will update this script so that it would work on Exchange 2013?

    • You’re right, that status is no longer reported in Exchange 2013. To get the answer you’d need to compare the mailbox size value to the quota (if any is set) on the mailbox (which can be set on the mailbox or the mailbox database).

  92. Leng says:

    Hi Paul,

    are there any command to export all shared mailboxes with size?
    Seems like Get-mailbox -RecipientTypeDetails sharedmailbox -Resultsize unlimited with parameter totalitemsize is not valid.
    Get-MailboxStatistics doesnt support receipienttype/type (so i can filter user or sharedmailbox) either,
    Kinda stuck in between!

      • PeterPhi says:

        Hi Paul,

        When i run this script on windows 2012 powershell i have the problem, please help. ((with exchange management shell is ok),

        Cannot process argument transformation on parameter ‘Identity’. Cannot convert value “test01” to type
        “Microsoft.Exchange.Configuration.Tasks.UserIdParameter”. Error: “Cannot convert hashtable to an object of the
        following type: Microsoft.Exchange.Configuration.Tasks.UserIdParameter. Hashtable-to-Object conversion is not
        supported in restricted language mode or a Data section.”
        + CategoryInfo : InvalidData: (:) [Get-User], ParameterBindin…mationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-User
        + PSComputerName : ex13

  93. PeterPhi says:

    Thanks Paul.

    But if we run on Windows Powershell , it will be faster in Exchange Management Shell. I tested with windows 2008 r2

  94. JoeS says:

    Hi Paul,

    Any idea why I would get “Starting a command on remote server failed with the following error message : The WinRM client sent a request to the remote WS-Management service and was notified that the request size exceeded the configured MaxEnvelopeSize quota.”

    This only happens on some users. When this happens, the csv file will be missing info related to Title, Department, Office, OU.


    • When I’ve seen the issue myself it has only been when EMS connects to a particular CAS. After the CAS is restarted (eg for patching) the issue goes away. I’ve never really gotten to the bottom of it. A workaround is to connect your EMS to a different CAS.

  95. Kelley says:

    I modified this script by adding a parameter for CustomAttribute1. This allows me to get a report for customer even though they have multiple databases.

    I’ve noticed that even though I start the script in exactly the same way for each customer, the column Deleted Items Folder Size (Mb) is not present in every report. It seems to be consistent. If it is not present in one customer’s report, it never is present there.

    Any ideas why this might happen?

  96. Jon says:

    Hi Paul,

    Thank you for this very useful script! Is there a way to add a column for Retention Policy? I tried adding it to the script manually, but apparently it isn’t a valid MailboxStatistics value.

    Thank you very much!

  97. ARX says:

    Hi Paul,

    I am looking for something that collects similar stats but for ActiveSync (Get-ActiveSyncDeiceStatistics) while combining some user AD fields such as their office location etc. Do you have anything in the works for something like that?

    Or can you suggest something?


  98. Carlo Wolter says:

    Hi Paul,
    thanks for the script… I was looking for a similar tool and this seems to fill my needs.
    But I have a tough time running it.
    EMS gives me twice a strange error message and dies gracefully… 🙁

    Environment: Windows Serrver 2008 R2 SP1 + Exchange 2010
    The error, translated back to English, is something like:
    Initializer type ‘Microsoft.Exchange.Diagnostics.ExTraceConfiguration’ generated an exception.
    + CategoryInfo : OperationStopped: (MYSERVERNAME.MYDOMAIN:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : JobFailure

    This error is printed on the console after:
    Collecting mailbox list
    and after
    Collecting report data

    I’m not a keep Exchange admin so I’m frozen at it…..

    Can you please give some advice ?


  99. James says:

    Hi Paul.

    Late to the party but when I run the script against any of our Exchange 2010 databases, I get:

    No mailboxes were found matching that criteria.

    I am not sure what I am doing wrong…

    • What is the exact command you’re running?

      You can also try just running “Get-Mailbox -Database ” and see if that works, since that is all the script really does when you use the -Database option.

  100. Anthony says:

    When I run the command on our 2008 server I keep getting Missing expression after unary operator ‘–‘. I confirmed powershell is 2.0 by running $host. Any ideas?

  101. Ludovic says:


    I’m French and so I use some others characters than you.
    I have to add : -encoding Unicode to get good letters.

    Thank you for this script.


  102. Eric says:

    Hi Paul,

    how can i execute your script if my database mailbox name is Mailbox Database 1159192321.
    Its possible? or i must rename the name first?


    • If the database name has spaces in it then you’ll need to enclose the name in quotes.

      .Get-MailboxReport.ps1 -Database “Mailbox Database 1159192321”

      This is one reason that I tend to keep my database names short and without any spaces in them, eg DB01, DB02…

  103. Hesta says:

    Hi Paul,

    How to use this script with selected database more 2 database ? let say I have DB_1 – DB_10 but we just need 2 database which generated on this script e.g DB_1 & DB_2.


  104. Howard Emerich says:

    The out put has 2 columns, Total Mailbox Size (Mb) and Mailbox Size (Mb). What is the difference between them, other than the numbers that are reported? Is the first number including white space and the second the actual mailbox size?

  105. Ramkumar says:

    Hi the script works perfectly alright
    However I would like to display server name / originating server name for a specific users
    What can be done

  106. Razi says:

    Paul ,
    Great Script, Hats up for you.
    The script run great with in powershell window with all the parameters defined.
    Any idea how to execute this script from .Net C# with command line arguments like -all , -server etc. Any Help will greatly be appreciated

  107. Mark says:

    This is a brilliant script. Are you able to detail how to automate emailing this out as a scheduled task? I can see no Email To parameters within the script, I would love to get this sent to me automatically each week. Thanks!

  108. Razi says:

    Hi Paul,

    The script gives error if I use it with out any parameter on the power shell command. It works fine if I use parameters.
    Can you please let me know , how to execute this script without a parameter, If I execute this without any parameter it should displays the same results as that of using “all” parameter. Thanks for creating such a great script.


  109. Razi says:

    Thanks for your reply Paul, Yes the script is written to require a parameter but I want to know if there is way to run it without parameter, Since you are a developer of the script I am requesting you to let me know how to run it without param as I am using it in my application which does not accepts any parameter and the design of my application is such a complex one which cannot be changed. You help will be highly appreciated.

  110. Jason says:

    When I run the script, regardless of what parameter I use, it does nothing but reloads the PS window. Am I missing something?

    • Dan says:

      I’m also getting the same:

      Exchange 2010 SP2 UR7
      Running on one of the Exchange Boxes so the Management Tools are installed.
      Script Unblocked and execution policy set to Unrestricted

      Also tried with a remote PS session from my Windows 8.1 machine, this appears to run the command but then crashes the window when it looks like its about to retrieve the result.

  111. Michael says:

    i have the same behaviour as Jason. run the script an nothing happens regardless of the paramter.
    script is not blocked and i am running Exchange 2010 .

  112. Todd L. says:

    I downloaded the new version and it will not run with any parameter. Gives message that file or all or not parameters.

  113. Alright, installed an Exchange 2010 server and found the bug. Anyone experiencing that issue should grab V1.04 from TechNet or Github. Let me know if there are still any issues.

  114. Essexboy says:

    Hi Paul, the script is running brilliantly when I manually trigger it via Powershell, however when I run the script from a Batch its popping up with the following message :

    Get-ActiveSyncDeviceStatistics : Operation is not valid due to the current stat
    e of the object.
    At C:ScriptsActiveSync ReportGet-EASDeviceReport.ps1:143 char:55
    + $EASDeviceStats = @(Get-ActiveSyncDeviceStatistics <<<< -Mailbox $Mailbo
    + CategoryInfo : NotSpecified: (:) [Get-ActiveSyncDeviceStatistic
    s], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Excha

    Are you able to assist? We are currently migrating from Ex2010 to Ex2013. Not sure if this causing the issue

  115. James Slack says:

    Hi Paul,

    I am trying to work out how you would write a script, which you can run against users to see how much email (item count and file size) they have over a certain age.

    The reason I would like this would be to work out which users to enable to Exchange 2013 Archiving first and justify what space we will recover.

    I’m not sure I have seen a cmd that would cover this though. My guess would be that this can only be done with something horribly complicated like EWS, but maybe you could suggest something I could use to write this that I am missing?

    Thanks as always

  116. James Slack says:

    Just to clarify my above comment.

    If we could have a script that would look at a mailbox and say that 15000 items that are 1.2GB in size are over 2 years old in the given mailbox, that would tell us everything we need.

  117. sam_in says:

    This script works perfect and getting report in the email if i use commands. I need to some help to configure this script in schedule task. Can you provide the steps to schedule this script in schedule task to get this report in the email in weekly or monthly period.

  118. Neil says:

    Thank you for your script Paul. Im having rouble running it though and am new to this.
    error is “You must provide a value expression on the right-hand side of the ‘-‘ operator. Which I am doing of course. Its referencing the -All or -Server parameter.
    Its Exch 2010 and im running from the server. I get the same error for each of the valid parameters.
    Any ideas please?
    Thank you

  119. Neil says:

    No mods and im confident its not the script. Rather the way I am calling it.
    I was using quotes around the script name but not this time.
    I run this
    .Get-MailboxReport.ps1 -All

    And get this:
    Missing expression after unary operator ‘–‘
    At c:filepathGet-MailboxReport.ps1:184 char:10
    + — <<</<!–
    + CategoryInfo :ParserError: [], ParseException
    + FullyQualifiedErrorId : MissingExpressionAfterOperator

  120. Neil says:

    Disregard my last Paul. All working great. Its Friday and im an idiot 🙁
    Thanks for your quick response.

  121. Bill Bollinger says:

    I am trying to run the script on an Exchange server 2013 Windows Server2102 an continue to get Import-Module : The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any
    module directory.
    At C:tempGet-MailboxReport.ps1:211 char:1
    + Import-Module ActiveDirectory -ErrorAction STOP
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    Can you help me out. This usually means that this is the wrong version of the script file

  122. Pam says:


    Can you tell me how you schedule this powershell script in schdeule task to get the report in email on weekly basis. I’m specifically looking for what arguments i need to enter in the schedule task to get weekly email.

  123. Marc Schnitman says:

    For whatever reason, the script is only returning a report, on the screen, for one user. And it always reports that one, and only one user.

    Q1 = How do I get this to report for all users, I have used the “-all” option
    Q2 = How do I get it to either e-mail me the CSV or create a CSV to a provided path. I have used both the e-mail and filename options, neither work.

  124. Marc Schnitman says:

    I’m running directly on our on-premise Exchange 2010, which is a Server 2008 R2 OS.

    NOTE: I’ve changed sensitive information in the printout below, for obvious reasons.

    [PS] C:EXCHANGE 2010 SCRIPTS>.Get-MailboxReport.ps1 -all

    Security Warning
    Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
    computer. Do you want to run C:EXCHANGE 2010 SCRIPTSGet-MailboxReport.ps1?
    [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): r

    Welcome to the Exchange Management Shell!

    Full list of cmdlets: Get-Command
    Only Exchange cmdlets: Get-ExCommand
    Cmdlets that match a specific string: Help **
    Get general help: Help
    Get help for a cmdlet: Help or -?
    Show quick reference guide: QuickRef
    Exchange team blog: Get-ExBlog
    Show full output for a command: | Format-List

    Tip of the day #8:

    Command line SOS! Do you need help? Type:

    Help or -?

    You can choose what information to return when you view Help by using the Detailed, Full, and Examples switches:

    Help Get-Mailbox -Detailed

    VERBOSE: Connecting to MAIL.DOMAIN.COM
    VERBOSE: Connecting to MAIL.DOMAIN.COM
    VERBOSE: Connecting to MAIL.DOMAIN.COM
    Failed to connect to an Exchange server in the current site.
    Enter the server FQDN where you want to connect.: exchange
    VERBOSE: Connecting to exchange
    WARNING: Active Directory server settings remained unchanged.
    Collecting mailbox list
    Collecting report data

    DisplayName : USER
    Mailbox Type : UserMailbox
    Title : Project Consultant
    Department : COMPANY
    Office : Home Office
    Total Mailbox Size (Mb) : 4602
    Mailbox Size (Mb) : 4581
    Mailbox Recoverable Item Size (Mb) : 21
    Mailbox Items : 24542
    Inbox Folder Size (Mb) : 3396
    Sent Items Folder Size (Mb) : 1179
    Deleted Items Folder Size (Mb) : 1
    Total Archive Size (Mb) : n/a
    Archive Size (Mb) : n/a
    Archive Deleted Item Size (Mb) : n/a
    Archive Items : n/a
    Audit Enabled : False
    Email Address Policy Enabled : False
    Hidden From Address Lists : False
    Use Database Quota Defaults : True
    Issue Warning Quota : unlimited
    Prohibit Send Quota : unlimited
    Prohibit Send Receive Quota : unlimited
    Account Enabled :
    Account Expires :
    Last Mailbox Logon : 8/10/2015 1:58:20 PM
    Last Logon By : DOMAINuser
    Primary Mailbox Database : DOMAIN
    Primary Server/DAG : EXCHANGE
    Archive Mailbox Database :
    Archive Server/DAG :
    Primary Email Address : user@domain.com
    Organizational Unit : domain/Users

    This is all it outputs anytime I run that script, also it won’t output to a file. Beginning to suspect something wrong with PS? However, other Exchange PS commands do work.

    • Maybe the script is getting blocked. It’s failing to connect to your Exchange server…. try simply copy/pasting the script contents into a new file and save that as a PS script and run that?

      • Marc Schnitman says:

        I have done that too. Odd thing is that the first attempt fails, but second attempt succeeds. I had to “allow” the script as seen in the output. I have also tried copy/paste into a new file: A) directly from GitHub and B) from the actual download – same result regardless.

  125. ek says:

    Hi Paul,

    I try to run the script, but output by below error message

    Import-Module : The ‘C:Windowssystem32WindowsPowerShellv1.0ModulesActiveDirectoryActiveDirectory.psd1’ module ca
    nnot be imported because its manifest contains one or more members that are not valid. The valid manifest members are (
    ‘ModuleToProcess’, ‘NestedModules’, ‘GUID’, ‘Author’, ‘CompanyName’, ‘Copyright’, ‘ModuleVersion’, ‘Description’, ‘Powe
    rShellVersion’, ‘PowerShellHostName’, ‘PowerShellHostVersion’, ‘CLRVersion’, ‘DotNetFrameworkVersion’, ‘ProcessorArchit
    ecture’, ‘RequiredModules’, ‘TypesToProcess’, ‘FormatsToProcess’, ‘ScriptsToProcess’, ‘PrivateData’, ‘RequiredAssemblie
    s’, ‘ModuleList’, ‘FileList’, ‘FunctionsToExport’, ‘VariablesToExport’, ‘AliasesToExport’, ‘CmdletsToExport’). Remove t
    he members that are not valid (‘HelpInfoUri’), then try to import the module again.
    At D:Get-MailboxReport.ps1:211 char:14
    + Import-Module <<<< ActiveDirectory -ErrorAction STOP
    + CategoryInfo : InvalidData: (C:Windowssyst…eDirectory.psd1:String) [Import-Module], InvalidOperatio
    + FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand

    Can you please advise?

  126. Cedric says:


    Thanks for this script, a really good Job..

    Is it possible to start the script and select only user in my OU ?
    example : -OrganizationalUnit “ou=MyUsers,dc=Domain,dc=com” ?

    Thanks for your reponse…

  127. F21 says:

    Thank you for the excellent script!

    Would be even better, if contain additional column: Total Mailbox And Archive size together.

    Mb should be MB 😉

  128. Robert Evans says:

    Ok guys what am I missing here? I have Exchange 2013cu8 running on Server 2012r2. When I try to run the script I that the output displayed below. But if I run this on an Exchange 2013cu10 on Server 2012 not r2 it runs fine. Is this because of r2 or am I missing something. Thanks in advance.

    [PS] C:UsersbevansadminDesktop>.Get-MailboxReport.ps1 -all
    At C:UsersbevansadminDesktopGet-MailboxReport.ps1:100 char:12
    + <!– –><form accept-charset="UTF-8" action="/cunn …
    + ~
    The '<#
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks (“&”) to pass it as part of a string.
    At C:UsersbevansadminDesktopGet-MailboxReport.ps1:492 char:180
    + …
    + ~
    The ‘<' operator is reserved for future use.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

        • I can’t see your file so I’ve no way to know for sure. But the error you’ve provided has strings like “form accept-charset=”UTF-8″” that don’t exist in the PowerShell script. Which makes it sound to me like you’ve gone to Github and done right-click -> download on the script’s file name.

          If you do that it downloads a bunch of HTML that isn’t part of the script (if you open it in an editor and see DOCTYPE HTML at the start then that will confirm my suspicion).

          So there’s not much else I can suggest without being able to see your system, other than going back to Github and making sure it’s downloaded properly, or download it from TechNet instead.

  129. Antoni says:

    Hi Paul,

    We are running Ms. Exchange 2007, and running more user with big size attachment when sending email via outlook and seamonkey, and the user mailbox is always full.

    And we alwayas delete the user mailbox that get full, and re-create the user mailbox, and here we need help, how to reduce or remove the full mailbox without to remove the user mailbox ?

    Thank you.

    • Deleting and recreating a mailbox just because the mailbox was “full” (which I assume you mean it has reached its mailbox quota) seems like overkill to me. The user could just delete some unwanted mail.

  130. Mike Williams says:

    Is there any way to add the retention policy applied in the output of this script and the mailbox features that are enabled?

  131. Anthony I. says:

    Thanks for providing this great tool. I wanted ask if there other parameters that could be used to pull stats for mailboxes within a child domain? We have a root domain that contains several child domains. Is there a way for your script to just search for users of single domain?

    Thank you.

  132. Paul says:

    Hi Paul,

    Thank you for this great script. Just wanted to know if it includes as well a way to detect if a userA had tried accessing a userB mailbox?
    Do you think that this is something that could be integrated by any chance?



  133. Jared says:

    Hi Paul,

    Brilliant script and has worked perfectly.

    Just wondering if there was an easy way of adding the mailbox quota size as a heading on the top 10 email form?

  134. Rajesh says:

    Hi Paul,

    Thanks for the great script.

    How can I check whether the mailbox is active or not for a list of email addresses in a text file using power shell ?


  135. lior says:

    hi paul
    having issue when i run the script

    The ‘<' operator is reserved for future use.
    At C:Get-MailboxReport.ps1:112 char:13
    + <!– < <<< –>
    + CategoryInfo : ParserError: (<:OperatorToken) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

    any advise ?
    thank you

  136. Kirk says:

    I need to keep stats on mailboxes relative to their retention policy. I have a one year retention policy, excluding contacts, calendar, tasks and drafts. I want to report on any mailboxes that have data beyond the retention policy. Can just get the mailbox size of data over a year, that would include data in the excluded folders.

    I believe I can use EWS to do this but have not found how to exclude the specific folders.

  137. David UK says:

    Hi Paul,

    Thanks for taking the time to create such a useful and widely used script.

    However, each time I run the script it doesn’t output any information in the ADUser columns (Account Enabled and Account Expires). Everything else is as expected. Is it me doing something wrong or do I need to modify the script to work?


    • That part relies on the Active Directory PowerShell module. From the same server or workstation that you’re running the script from, can you run AD cmdlets like Get-ADUser without error?

  138. Tom says:

    I am running from my local Windows 7 machine with RSAT installed. I remotely connect PS to one of our mail servers. I am able to run other scripts with no issues. But when I run .get-mailboxreport.ps1 -database “database A” it immediately comes back to a prompt. There is no error. No file is created. I am not sure what I am doing wrong here, hopefully you can tell me how to correct it. -Thanks

  139. Carlos says:

    Hi Paul,

    First, many thanks for another fantastic script!
    I’m running it in an Exchange 2013 CU7 (Server 2012 R2) environment. The script runs fine and dumps the csv format report in the directory. However, I do not get it emailed to me although the report data in the shell shows “Sending email report… Finished.”

    Please help – Thank you!

  140. Daniel says:

    first off the script is awesome, thank you.
    i am trying to email the results to an outside email address. however i get unable to relay error. the script is running on the exchange server. i can send the email to an internal address with no problem. would you know what i need to change to allow it to relay to an external address? when i do a manual command to send an email to an external address i can use the -credential $credential command and it pops up a window for login, that works but i cant do that from a scheduled task. to add to the confusion i have been able to setup the script in a scheduled task on two exchange server and get the email but i have tried on three other servers and it will not relay. i have checked the send connectors on all the servers and none of them, including the ones that work, have an open relay for the exchange server’s IP address. they have relay for other devices but the exchange server’s IP is not in there, nor is 127…
    curious if you have any advice. thank you for the script, its very very helpful in keeping track of the ever exploding email boxes.

    • If you’re trying to relay to an external address, then you either need to authenticate the SMTP session, or you need a relay connector that allows that IP to relay.

      But I don’t recommend adding an Exchange server’s IP to any relay connectors, that will most certainly break internal mail flow.

      Personally, I run these types of scheduled scripts from a separate management or monitoring server.

      Plus, you could try sending the report to a distribution group. That is an internal email address, so it should be accepted, and it can contain contacts for external addresses.

  141. RHV says:

    I am running the script from my laptop. I get all mailboxes with most of the data, but for all Size columns I get “n/a”.

    Issue warning Quata, Prohibit send, Account Expires, last logon are also blank.

    I have tried to run the scipts as Administrator, both in Power Shell and in ISE

    I don’t want to install the Exhange Management Console on my Exchange server so I am running it from my laptop on Windows 7.

      • RHV says:

        Yes, the Exchange management tools are installed.

        The script is also running and I get most of the info for all my users
        – just not the about about sizes and so on…

      • RHV says:

        I found the problem….

        My user did not have enough rights. I logged on my computer with Domain administrator and then I got all relevant information.


  142. Rahul says:

    Hey Paul
    I getting error unable to relay email, after completion of script. And how to add two different database names i. e get-mailboxdatabase db-1 and db-9, and 3rd error is unable to split , while retrieving database drive space.

  143. Ron Kauffman says:


    I ran the report, and it worked great. You have item counts for the mailbox. But could you add item counts for the Inbox, Sent Items and Deleted Items folders?



  144. Joe says:

    My report takes over 3 days to run, i only have about 6000 mailboxes.
    Only one time i ran it, it ran in 4 hours.(magical time)

    Any ideas?



  145. Hugh Dunlop says:

    Hi Paul,

    Thanks for the script, however this month it will not run! When I go to run the script all I get is …

    C:ScriptsGet-MailboxReport.ps1 : Parameter set cannot be resolved using the specified named parameters.
    At line:1 char:1
    + .Get-MailboxReport.ps1 -server -file c:scripts250416.csv
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-MailboxReport.ps1], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Get-MailboxReport.ps1

    Any help would be welcomed.

  146. Doug Walker says:

    I am trying to add a umenabled field to this report. I have been able to add other fields, but having issues with this.
    I have tried adding $userObj | Add-Member NoteProperty -Name “Umenabled” -Value $mb.exumenable
    But the field I s blank. Also tried ummailbox with the same result
    Any ideas?
    Great script by the way

  147. Joe G. says:


    First, thanks for everything through the years, you have been a huge source of guidance.

    This script works great, I get the CSV I want in the drop folder, no problem.

    The -MailFrom seems to have issues. It doesn’t like my input value to some degree.

    I get a get-mailboxreport-error log of:
    “Cannot validate argument on parameter ‘From’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.”
    I am trying to mail the results to multiple addresses as a scheduled task behind a BAT file as follows:
    C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command “. ‘C:Program FilesMicrosoftExchange ServerV15binRemoteExchange.ps1’; Connect-ExchangeServer -auto;” “C:scriptsGet-MailboxReport.ps1 -All -SendEmail -MailTo xxxx@xxx.com;xxxx@xxx.com;xxxx@xxx.com -MailFrom ExchangeReports@xxx.com -MailServer smtp.xxx.com”

    Where all addresses are internal
    Where smtp.xxx.com is an internal open relay (works for all other scripts, apps, telnet :25, etc.)
    Exchange is 2013CU11 4 multi-role member / 2 site DAG
    Running from 2012R2 server with all AD modules + Exchange 2013CU11 tools (modules)

    I haven’t modified the script, except for code signing it. (Required)

    Any ideas ?

    • Joe G. says:


      Nevermind, 🙂

      I put a ‘pause’ in the BAT and could see that it did not like multiple addresses. I will have to create a distro group and send it there.


  148. Peter Nagel says:

    Thanks for this work! I added some code to add two additional fields: SIP Address (containing the Skype for Business SIP Address of the user) and “All Email Addresses” which contains a comma seperated List of all email alias addresses a mailbox has. If you want to incorporate these changes please feel free to contact me to send the modified script to you 🙂

  149. A K M Mahbubul Hossen says:

    This is a nice scripts for day to day administration. But i am facing a problem. While i get the report i found Account Enabled and Account Expires column blank. Nothing is found for this two column. Please help me to solve the issue.



  150. A K M Mahbubul Hossen says:

    This is a nice script for day to day administration. But i am facing a problem. While i get the report i found Account Enabled and Account Expires column blank. Nothing is found for this two column. Please help me to solve the issue.

    I have below modules are installed in my exchange mailbox server from where i am executing the script.
    [PS] D:Program FilesMicrosoftExchange ServerV14scripts>get-module -listavailable

    ModuleType Name ExportedCommands
    ———- —- —————-
    Manifest ActiveDirectory {}
    Manifest ADRMS {}
    Manifest AppLocker {}
    Manifest BestPractices {}
    Manifest BitsTransfer {}
    Manifest FailoverClusters {}
    Manifest PSDiagnostics {}
    Manifest ServerManager {}
    Manifest TroubleshootingPack {}
    Manifest WebAdministration {}


  151. Alex says:

    Hello Paul,
    thank you very much for this script.

    When I try to run it, I get a “NullReference” Exception.

    The last line in the Powershell window is “Collecting mailbox list”.

    Its a 2012 Server with Exchange 2010 (14.3 123.4).

  152. Juns says:

    Hello Paul,

    This script is amazing and does get all the details.

    How can we have the script run against a specific OU to retrieve the details of users belonging to a specific OU only.

    This would be really helpful for me. Thank you!


  153. Max P says:

    I just cant get this script to run on our exchange server 2010.
    Always getting error. Im just using it as explained in your video.
    No matter with what switch i use it just gives me back these lines

    At C:Users.DesktoppowershellGet-MailboxReport.ps1:116 char:13
    + <a href="/open-source" class="js-selected-navigation-item nav-item n …
    + ~
    The '<' operator is reserved for future use.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:118 char:13
    + <a href="/business" class="js-selected-navigation-item nav-item nav- …
    + ~
    The '<' operator is reserved for future use.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:120 char:13
    + <a href="/explore" class="js-selected-navigation-item nav-item nav-i …
    + ~
    The '<' operator is reserved for future use.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:122 char:11
    + ~
    The ‘
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks (“&”) to pass it as part of a string.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:2307 char:11
    + © 2016 <span title="0.07444s from github-fe155-cp1-prd.iad.github …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:2307 char:23
    + © 2016 <span title="0.07444s from github-fe155-cp1-prd.iad.github …
    + ~
    The '<' operator is reserved for future use.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:2307 char:29
    + © 2016 GitHub’ in expression or statement.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:2307 char:100
    + … “>GitHub, Inc.
    + ~
    Missing argument in parameter list.
    At C:Users.DesktoppowershellGet-MailboxReport.ps1:2326 char:14
    + You can’t perform that action at this time.
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The string is missing the terminator: ‘.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

    Can someone help me ? What am i doing wrong?

  154. GAV says:

    Hi Paul,

    I’ve run the script and it works great but when I try to run it as scheduled task it’s not doing much. Have you ever run it as a scheduled task?



  155. joshua says:

    I am running into the same error message “cannot process argument transformation … ”

    I am using Exchange 2010, so the advice about referring to storage groups is not meaningful.

    How can I fix this ?

      • joshua says:

        I am using the Exchange Management Shell. The error and the version table are:

        Welcome to the Exchange Management Shell!

        [PS] C:Windowssystem32>.get-mailboxreport.ps1 -database m:databasexxxxxxxx.edb

        VERBOSE: Connecting to xxxxxx.xxxx.local
        VERBOSE: Connected to xxxxxx.xxxx.local.
        WARNING: Active Directory server settings remained unchanged.
        Collecting mailbox list
        Cannot process argument transformation on parameter ‘Database’. Cannot convert value “m:databasesharedemail-sg.edb” t
        o type “Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter”. Error: “‘m:databasesharedemail-sg.edb’ is not a
        valid value for the identity.
        Parameter name: Identity”
        + CategoryInfo : InvalidData: (:) [Get-Mailbox], ParameterBindin…mationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-Mailbox
        + PSComputerName : ny-paperboy.onssi.local

        Collecting report data
        No mailboxes were found matching that criteria.

        [PS] $psversiontable

        Name Value
        —- —–
        CLRVersion 2.0.50727.5485
        BuildVersion 6.1.7601.17514
        PSVersion 2.0
        WSManStackVersion 2.0
        PSCompatibleVersions {1.0, 2.0}
        PSRemotingProtocolVersion 2.1

  156. Shaik says:

    Hello paul,

    Could you please help me with the script where the quota emails triggers to admin when any users reach the quota limit.

  157. Paul Lee says:

    This script is amazing! I was wondering if there is a way to report on mailbox items that are less than 30 days old? In other words, total items and size for the most recent 30 days, discarding anything older than that.

  158. tom smith says:

    Hi Paul,

    should this script also flag archive mailboxes on the databases?
    ive just run the script against an archive db and it doesn’t flag any users?

    works fine on the other databases

    • Without really looking into it, I’d guess that the script is not handling that scenario properly. I’ve made a note in my GitHub issues register to take a closer look at some stage.

      As a workaround I’d suggest, if practical in your environment, just running a report of the entire org and filtering in Excel to get the view that you’re looking for.

  159. Piter says:

    Hi Paul, can you help me?

    How could I control the growth of mailboxes? I want to do the operations in excel.


  160. Jimmy Wang says:

    when I run this script I get the version error. my windows powersehll is version 4 and exchange powershell is version 2.

    I took exact same script to run on different machine that is running Windows powershell version 2 and exchange powershell version 2 and it runs fine.

    Does this mean this script Get-MailboxReport.ps1 doesn’t support Windows powershell version 4 ?

    verson : The term ‘verson’ is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + verson
    + ~~~~~~
    + CategoryInfo : ObjectNotFound: (verson:String) [], CommandNotFoundException

    PS C:\> $PSVersionTable.PSVersion

    Major Minor Build Revision
    —– —– —– ——–
    4 0 -1 -1

    • “verson : The term ‘verson’ is not recognized as the name of a cmdlet, function, script file, or operable program.”

      Did you modify the script? If so, looks like you’ve misspelled “version”?

  161. Jimmy Wang says:

    How to email with multiple recipients in one string instead ? some of the user is not in same distribution group and would like to including them. My work around, is to modify/add this parameter but I can’t add more than one user per string.

    [Parameter( Mandatory=$false)]

    [Parameter( Mandatory=$false)]

    [Parameter( Mandatory=$false)]

  162. Muhammad Kamran Khan says:

    Hi Paul,

    can i get all mailbox calendar permission excluding default and anonymous, if can quickly help i will be great i have exchange 2013 with hybrid deployment.

    • Short answer: add a parameter to the script, call it something like MailPort or SMTPPort. Make it a default value of 465 if you want.

      Add to the email settings at around line 173, the extra setting for Port = $MailPort

  163. Jimmy Wang says:

    is it possible I can use -match switch in my search ?

    Example, i’m look for ManagedFolderMailboxPolicy in match specific policy and output out to csv file. how do I insert “match” switch in the script ?

    if($database){ $mailboxes = @(Get-Mailbox -ResultSize Unlimited | ? {$_.ManagedFolderMailboxPolicy -match “Exchange2007-Unlimited) }

      • Jimmy Wang says:

        Sorry for posting different places. though it was different blogs.

        what is correct line ? I think Im doing it wrong when I insert this line
        if($database){ $mailboxes = @(Get-Mailbox -ResultSize Unlimited | ? {$_.ManagedFolderMailboxPolicy -match “Exchange2007-Unlimited) }

        can you help me to identify what am I doing wrong ?

        • You’re modifying the line that is run when the -Database parameter is used to query the mailboxes on a single database.


          There are multiple Get-Mailbox commands depending on which script parameter is used, so you will need to modify the command that is applicable to how you’re using the script.

Leave a Reply

Your email address will not be published. Required fields are marked *