Generate Message Profile for the Exchange Calculators (v2.1)

This PowerShell script generates average user messaging profiles per AD site based upon their current environment. The message profile can be exported to a CSV collection, and the script supports processing multiple data collections back into a single long term message profile.

5 Star
10,032 times
Add to favorites
E-mail Twitter Digg Facebook
  • Error when running script
    1 Posts | Last post September 25, 2018
    • Hi
      I am trying to run this script but keeps on failing I have downloaded as is and made no changes
      [PS] C:\Temp>.\GenerateMessageProfile.ps1 -StartOnDate 09/27/2018 -EndBeforeDate 09/25/2018
      Missing expression after unary operator '-'.
      At C:\Temp\GenerateMessageProfile.ps1:1405 char:62
      +                                                             - <<<< Start $StartOnDate.AddHours($TimeSpan) -End $EndBe
      foreDate.AddHours($TimeSpan) -EventID Receive `
          + CategoryInfo          : ParserError: (-:String) [], ParseException
          + FullyQualifiedErrorId : MissingExpressionAfterOperator
  • Server Exclusions
    2 Posts | Last post March 09, 2018
    • Dan,
      Would it be possible to add a command line parameter to exclude specific servers from the query list?
    • Sorry I didn't see the question sooner.
      Why would you want to exclude a mailbox and/or transport server? Technically they should be involved in collection of data.
  • Does this now work with 2007?
    2 Posts | Last post August 24, 2017
    • Tried running it on a 2007 Exchange Server, and the Exchange Management Shell crashed a few seconds later.
    • I was never able to get this to work on Exchange 2007/PowerShell v1.0. As you found out the script litterally crashes the PowerShell window.
      For now I recommend you use one of the other scripts referenced on the linked Blog article, as they will get you the stats (although they will take a little longer) and you just need to do some data messaging when they are done.
  • Not reporting correct number of users?
    4 Posts | Last post April 06, 2017
    • Dan,
      All of my mailboxes are in the Root domain but the actual user accounts are in Child domains. Is this why it is currently miss reporting the number of users? I have set-adserversettings ViewEntireForest = $true but after running the script the resulting mailboxes results show 60 and we know there are at least 500 in the organization. Any thoughts?
    • Every single server gathering job uses the following line if the server is detected as a mailbox server and a mailbox gathering is performed:
      Set-ADServerSettings -ViewEntireForest $True | Out-Null
      After that when the mailboxes are gathered, they are done so using this line:
      $Mailboxes = Get-Mailbox -Server $ExchangeServerFQDN -ResultSize:Unlimited -Filter ([ScriptBlock]::Create($MailboxFilter)) -ErrorAction Stop | Select-Object PrimarySmtpAddress
      If you run using the -Debug and -Verbose switches, you can not only see what the script is doing behind the scenes (-Verbose), but you can see what the filters are that are being used (-Debug). It's possible there is something in the $MailboxFilter that doesn't agree with your environment, but I doubt it since unless you are using a bunch a switches this is the only $MailboxFilter being used:
      $MailboxFilter = '(RecipientTypeDetails -ne "EquipmentMailbox") -and (RecipientTypeDetails -ne "DiscoveryMailbox")'
      Also please make sure you are running the latest version of the script.
    • Hi, I also had some issues with incorrect number of users reported, tracked it down to  issue with servername not always updated on mailboxes:
      As a workaround i changed the lines:
      $Mailboxes = Get-Mailbox -Server $ExchangeServerFQDN -ResultSize:Unlimited `
      -Filter ([ScriptBlock]::Create($MailboxFilter)) -ErrorAction Stop | Select-Object PrimarySmtpAddress
      In to this:
      $Mailboxes = Get-MailboxDatabase -status | Where-Object {$_.MountedOnServer -eq $ExchangeServerFQDN} | Get-Mailbox -ResultSize:Unlimited `
      -Filter ([ScriptBlock]::Create($MailboxFilter)) -ErrorAction Stop | Select-Object PrimarySmtpAddress 
      And that seems to work better for me.
    • @pstrom - Its true that the server name on a mailbox is not changed as a mailbox database is moved between servers in a DAG, but if the mailbox is moved outside of that DAG to another server through a move mailbox operation the field should be updated. In that case it shouldn't matter which server is being reported as the owner of a mailbox as all the are in the same DAG.
      If a DAG spans multiple sites, then you need to select/include both sites and use the -AverageAllSites switch to get a complete/comprehensive view of the message profile for users in that DAG. If you don't then you may be missing message tracking data on the server their mailbox was hosted on at the time of data collection.
  • Run for DAG spaning multiple AD Site
    3 Posts | Last post January 04, 2017
    • Hi Dan, 
      Thank you for offering this great script.
      I would ask if it possible to run the script against DAG instead of AD site.
    • The short answer to your question is no you cannot target a specific group of servers in a site without modification to the script. And you really don't want to do this (see below).
      My question to you is why do you want to only target a specific group of servers, DAg or otherwise, in a site? Any server with the transport role can deliver messages to any mailboxes in a site, so by excluding some servers in site could significantly impact the message profile. In other words the message profile is o ly as good as the servers that were included in the generation of it, so you want each and every server in a site.
    • I just wanted to add the note after looking at the title of your question that you should specify both AD sites the DAG spans using the -ADSites parameter to make sure you get both halves of the DAG. Again there could be other servers in those two sites supporting mail flow to and from the DAG so you don't want to exclusively focus on just DAG servers.
  • Message profiles by groups
    2 Posts | Last post November 19, 2015
    • Great script Dan!,
      I'm confused about how to use the statistics generated by this in the Exchange calculator, though.   In the calculator you can specify up to four different profiles for messages sent/received, etc.
      However your script collects and aggregates data for all mailboxes and creates and average for all of them.
      How do you break these numbers down into four different groups for each profile?
    • The calculators allow you to specify multiple user profiles but you only have to use 1. If you wanted to use multiple profiles, then you could by specifying different mailbox sizes and/or expected IOPS/CPU increases, but have all of them use the same message profile of messages sent/received and message size.
      The user message profile generated by this script is an aggregate of all of their messaging activity as you indicated. Lets use the example of you having 20,000 Exchange users in a site that you want to upgrade to the next version of Exchange. The Role Requirements calculator will spit out the same system design whether you use the 20,000 user aggregate message profile, or if you knew and used the actual and separate message profiles of 5,000 heavy users/10,000 normal users/5,000 light users. The net result of the calculator will be the same in that it assumes an even distribution of those users so the overall design will be the same.
      If you still feel you want separate message profiles for 4 types of users, then I encourage you to explore the other scripts I referenced in the associated blog post here:
      At least one of them, if not both, will provide you a per-user (SMTP address) output that you can then use to group your users together however you like. The scripts will take longer and you will have to do some manipulation of the numbers, but again the net result of the output of the Role Requirement calculator should be the same.
      I hope that makes sense.
  • Received Messages
    2 Posts | Last post July 14, 2015
    • I have 2 x 10 server 2013 DAGs each stretching 2 AD sites and this script is not picking up messages received and in some cases zero sent items, yet my organization nearly receives between 3 and 5 million emails a week.
    • Disregard, problem on my end.
  • Shared Mailboxes
    2 Posts | Last post May 08, 2015
    • Awesome job on this, thanks for sharing. Any chance you could allow exclusion (or exclusive inclusion) of shared mailboxes in a future version?
    • Since there is a RecipientTypeDetails of SharedMailbox, that shouldn't be a problem to exclude it from the mailbox count for a site in a future version. 
      However I want to clarify that there is no easy way to exclude those mailboxes from the message count for a site, so if they generate a lot of traffic they could artificially inflate the message profile for the mailboxes that are included.