Quick Tip (Revisited) – How to get the physical sizes of Exchange Databases (in different versions of Exchange from a single script)
A couple of weeks back I published a very simple script which I had been using on a few versions of Exchange to determine the physical sizes of each of the EDB files. A reader commented that in Exchange 2010 – such an elaborate script was not needed as the Get-MailboxDatabase cmdlet contains a “DatabaseSize” property which is populated from the Information Store on each mailbox server when the “–Size” parameter is used.
Or this one liner… Get-MailboxDatabase –server <ServerName> -status | select ServerName,Name,DatabaseSize
Of course Bjarni was correct – but his comment led me to consider how I had been using my original script. As I was familiar with the code and the environments that I was executing it within – I would modify it to essentially “work” when it stopped doing so – however, when I published a version of the the code on telnetport25.com – I discovered that what I produced was not all encompassing (or generic enough). Therefore;
- Execution against Clustered 2007 Instances would not return any data
- The script did not account for different versions of Exchange, and therefore did not use the most optimal command line syntax between 2007 and 2010
Given the above I have re-written the original script (and replaced the download with the new script) so that it will now:
- Recognise the different syntax between the cmdlets required by Exchange 2010 and Exchange 2007
- If the host environment is Exchange 2007, determine if the mailbox is hosted on a cluster or a basic Exchange instance and report on the physical database sizes
In order to work correctly in an Exchange 2007 environment the account in which the context of the script is run needs to have access to the hidden share at the root of each Exchange server (c$ for example).
Aside from the mail purpose of the script, there are some other learning points contained within its syntax – for example;
- Exchange 2007 / 2010 – How to simply detect the major version of the Exchanger on a given server
- Exchange 2007 CCR – How to determine the Active CCR node
The output of this script looks like the following depending on the version of Exchange that it executes against:
The (revised) Script
You can review the script below, or you can click on the download link provided in the Download section.
You can download the scripts from the following location:
Execution of the script is as described in the original article.