• Link to Facebook
  • Link to LinkedIn
  • Link to Youtube
Priasoft
  • O365 & Exchange Server Management Tools
    • Office 365 & Exchange Migration Solutions
      • Public Folder Migration & Synchronization Manager
      • Priasoft Migration Suite for Exchange & Office 365
      • Mailbox Migration Manager
      • Office 365 Tenant-to-Tenant Migration
      • Collaboration Suite for Exchange (GALSync) – Two-way Sync AD organizations
      • Outlook Rules Migration Utility
      • Outlook Profile Update Manager for M365
    • eDiscovery & Compliance for Exchange
      • Exchange Data Discovery Lab
        • Exchange Data Discovery Lab – For Government Agencies
        • Exchange Data Discovery Lab – For HR & Compliance
        • Exchange Data Discovery Lab – For AI & Data Science
        • Exchange Data Discovery Lab – For IT Operations
        • Exchange Data Discovery Lab – For Legal Professionals
    • Exchange Data & Reporting Tools
      • Public Folder Analyzer for Office 365
      • Super-ExMerge – ExMerge for Exchange
    • Other Solutions and Free Tools
      • AutoDiscover Test Tool
  • Office 365 Migration Services
    • Expert Exchange Public Folder Cleanup & Discovery Services
    • Public Folder Migration Service for Office 365
    • Microsoft 365 Migration Success & Planning Workshop
  • Exchange Insights & Tips
    • How to Migrate Public Folders – Complete Guide
    • How to Backup Public Folders to PST
    • Best Way to Import Quickly PST’s to Office 365
    • Resources Library
  • Company
    • About Priasoft
    • Contact Us
    • Customer Success Stories
    • Press and Latest News
    • Priasoft Community Blog
    • Product Support
      • FAQs
      • Knowledge Base
      • Contact Support Team
      • Support Documents
    • Partners
      • Recommend a Partner
    • Why Priasoft?
      • What’s New Priasoft
      • Priasoft Migration Suite Features
  • Start Evaluating
  • Menu Menu

Tag Archive for: Get-MailboxStatistics

Get-MailboxStatistics and the lack of an Integer

Technical
Priasoft Migration Suite for Exchange (PMSE)
The other day while working on a new feature of the Priasoft Public Folder Toolbox a need arose to capture the available space on each Public Folder mailbox in Microsoft Office 365.  Naturally the immediate idea was to use the results from Get-MailboxStatistics to get such information. Get-MailboxStatistics returns many valuable bits of information about a mailbox, including Public Folder Mailboxes.  There are the obvious values like TotalItemSize and ItemCount.   There’s also the values for the established limits such as DatabaseProhibitSendReceiveQuota, which, if present, is the maximium amount of data the mailbox can contain before it will reject creating or saving new content.  There’s a few other values as well…some dates, GUIDs, and the legacyExchangeDN (aka x500). However, missing from the list of values are any percentage values like %FreeSpace or %Utilized.  Some other missing values are the total free space available as compared to the quota, if a limit exists.  Granted, such values are easily calculated but would have been easy for Microsoft to have provided along with all the other values.  Furthermore, Microsoft does this calculation for you in the web admin console for Exchange and Office 365. So, this new feature is to help customers with the headache of distributing a large amount of Public Folder data across two or more Public Folder Mailboxes.  In Office 365 a Public Folder mailbox has either a limit of 50GB or 100GB (depending upon the version of the back-end tenant; Microsoft is slowly updating tenants for the newer limit of 100GB).  If a customer has 500GB of Public Folder data, it has to be distributed across several mailboxes.  However, Exchange will not automatically start pushing data to a new mailbox just because the first one fills up.  Office 365 does have an “auto split” function that will split a Public Folder mailbox when it reaches its capacity, but such is not immediate nor quick.  Reports from customers are that the auto-split process can take many hours, several days, or even a couple of weeks to complete.  It is likely that the total item and folder count has much to do with the duration since there is a need to actually move items and folders from one Public Folder mailbox to another. The above reality leads to a situation of needing to understand the data at hand and determining how to distribute that data across multiple mailboxes but without filling up any single mailbox.  In order to do that, an analysis of each Public Folder mailbox is needed to understand its limit and how much data already exists in it (in the case of using pre-existing mailboxes). The frustration presented by Microsoft in the Get-MailboxStatistics output is that nearly all of the apparent numeric values are, in fact, not numeric at all and are an object that, when converted to a string for showing in a typical powershell text console, is formatted with a human readable value such as: 22.34 GB (22,339,443,193 bytes).  At first, those who are familiar with powershell will likely imagine that there must be some property of the value that allows one to get to the actual numeric value…and while technically true, access to this property is only available when powershell is running on the Exchange server.  When running remote powershell, as is the case with Office 365, the results from Get-MailboxStatistics are a simplified version of the original object so that it can be transmitted to the powershell console.  The value object, when on the Exchange server, has some functions to convert the value to GB, MB, KB, and bytes…but the simplified version of the object doesn’t have the functions to make these conversions – because the object is a data-only copy…none of the function code is sent from the server to the powershell console. Luckily the string representation of the value (as seen by .ToString()) does contain the “bytes” value in the text.  The string must be parsed and the numeric value extracted and converted to a number.  In .NET code, this is accomplished most completely by the following, where ‘prop’ is one of the numeric values from Get-MailboxStatistics:
System.Int64.Parse(System.Text.RegularExpressions.Regex.Match(prop.Value.ToString(), "([0-9" & Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator & "]+) bytes", RegexOptions.IgnoreCase), Globalization.NumberStyles.Number)
The above uses .NET powerful Regular Expression pattern matching engine to ensure that, regardless of number formats around the world, the digits are found and extracted properly.  Of key importance is the use of Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator so that regions that use a “.” as a thousands separator are properly picked up. In pure powershell the same can be done as follows:
[Int64]::Parse([System.Text.RegularExpressions.Regex]::Match(prop.Value.ToString(), "([0-9" & [Globalization.CultureInfo.CurrentCulture.NumberFormat]::NumberGroupSeparator & "]+) bytes", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase), [Globalization.NumberStyles]::Number)
If you are searching for this issue, you’ll find other sites using string.Split() to handle this, but there’s no guarantee that the “(” will always be there (Microsoft can change the formatting at any time) and also the handling of the thousands separator is not being done.  The above versions should work in any case where there are numbers-and-separators followed by a space and the text ‘bytes’. It is a frustrating issue that Microsoft could have solved by simply adding an Int64 property to the numeric value object…but such wisdom seems to escape them sometimes :).    
April 18, 2017
https://www.priasoft.com/wp-content/uploads/2024/10/HomePg_Image_PMSE.png 150 150 Eriq VanBibber /wp-content/uploads/2016/01/Pria_email_logo.png Eriq VanBibber2017-04-18 01:41:102026-04-23 13:20:34Get-MailboxStatistics and the lack of an Integer

Recent Posts

  • Office 365 Tenant to Tenant
    Tenant-to-Tenant Migration Checklist: What to Do Before You Move a Single MailboxMay 19, 2026 - 2:00 pm
  • Super-ExMerge (SXM)
    What Is Super-ExMerge and Why Do IT Teams Still Need It in 2026?May 12, 2026 - 2:00 pm
  • Priasoft Migration Suite for Exchange (PMSE)
    Exchange 2019 Patches Just Ended. Here Is What IT Teams Need to Do This Month.May 5, 2026 - 2:00 pm

Archives

Categories

  • Compliance
  • eDiscovery
  • Guide
  • How to
  • Microsoft 365
  • News
  • Outlook PST
  • Press Release
  • PST Data Management
  • Public Folders
  • Security
  • Technical

The Exchange Experts – Who Are We?

Priasoft, a Microsoft Partner, offers enterprise-class solutions for Exchange migration, management, and eDiscovery. Supporting Exchange 2010, 2013, 2016, 2019, and Office 365/Exchange Online, our platform enables secure migration, management, and organization of email data, with advanced tools for compliance, public folder analysis, and AI-driven insights.


YouTube Play Button  LinkedIn LogoFacebook Logo

Exchange Quick Links

• Exchange Data Discovery Lab (eDiscovery)
• Public Folder Migration to Office 365
• Public Folder Analyzer for Office 365
• Super-ExMerge for Office 365
• Collaboration Suite (GalSync)
• Microsoft Outlook Profile Update Manager
• Privacy Policy
• Terms of Use

Recent Posts

  • Tenant-to-Tenant Migration Checklist: What to Do Before You Move a Single Mailbox
  • What Is Super-ExMerge and Why Do IT Teams Still Need It in 2026?
  • Exchange 2019 Patches Just Ended. Here Is What IT Teams Need to Do This Month.

Contact Priasoft – The Exchange Experts

Have questions? Speak to a Priasoft Engineer
Email: sales (at) priasoft.com
+1 (480) 520-0873

Scroll to top Scroll to top Scroll to top

This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.

OKLearn more

Cookie and Privacy Settings



How we use cookies

We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.

Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.

Essential Website Cookies

These cookies are strictly necessary to provide you with services available through our website and to use some of its features.

Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.

We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.

We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.

Other external services

We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.

Google Webfont Settings:

Google Map Settings:

Google reCaptcha Settings:

Vimeo and Youtube video embeds:

Privacy Policy

You can read about our cookies and privacy settings in detail on our Privacy Policy Page.

Privacy Policy
Accept settingsHide notification only