If you are in charge of running the Exchange server for your office, one of the things you want to know is how much growth your Exchange server is experiencing on a day to day basis. In short: you want metrics to be able to maintain your server.
Using Exchange 2007, this is a piece of cake, however at the time of this writing quite a few companies are still on Exchange 2003, so that's what we'll be looking at here.
What you might be looking for is to be able to create Excel graphs such as this:
Figure 1: only one of the information stores
Figure 2: all the information stores added up
As you can see in figure 2 this is an overview of the total size of all the information stores on in this case pretty large Exchange server (over 560Gigabytes of data in the InfoStores). Here you can see the growth of the size over the last 8 days. It'easy to spot the weekend (the 9th and 10th). Another thing this immediately shows is the gradual growth at the start of the week, and the dip at the end where I have purged some old mailboxes. To help create similar graphs to assist you in your administrative work I have made a VBScript that gathers this kind of information.
Why use this?
Over time it's nice to be able to get an idea of the monthly growth, as this can for example help you calculate when more storage will be needed. Another thing this data might help you with is to convince management to finally start implementing those mailbox limits. Remember: a picture tells more than a thousand words!
How it works.
To get this data we need to dive pretty deep into WMI and ADO. In fact as far as I know it's not even possible to directly find the size of the information stores. Note that the actual size of the .edb files is not the same; our script actually goes through all the mailboxes on the given server (note that you need to start the script using the correct administrative credentials). It then inventories those mailboxes and determines the InformationStore they belong to (if there are several). It then adds the sizes of the mailboxes to get the actual data in the information store. Note that the script can be run over the network, so it does not need to be installed on the Exchange server.
Filesize versus information store size
As mentioned the filesize of the .edb file is a different (larger) number, as it also includes any messages and mailboxes that are supposed to be deleted, but are only –marked- as deleted in the database. Only after an offline defragmentation of the database you will be able to reclaim that space.
How to use the script
The script needs to be started from the command prompt, using cscript.exe. In fact, you may want to use the '/nologo' option, so that no additional information is logged by the windows scripting host. Use your Exchange servers name as an argument and optionally /verbose for more details.
The script can output the data in two ways; the default output will look something like this:
C:\Scripts>cscript /nologo GetInfoStoreDetails.vbs ex-server
12-8-2009;12:41:09;SG2;EX-SERVER-IS2A;150414102;SG3;EX-SERVER-IS3A;128056846;SG4;EX-SERVER-IS4A;40096114;SG1;EX-SERVER-IS1A;253176696;
This default mode is ideal if you would want to log this to a file, and schedule a task that may for example run every night and in this way build a .csv file with historic data that enables you to create graphs such as the one above. Remember that '>>' to redirect standard output will add it to the file that you may be logging to. It would however be very simple to chang the script to actually write to a file directly.
However, using the '/verbose' mode you will get more information, as well as something that is formatted to be a little bit more understandable.
Example:
C:\Scripts>cscript /nologo GetInfoStoreDetails.vbs srv-ex0001 /verbose
The Information stores on: srv-ex0001
Name StoreName Size
SG2 SRV-EX0001-IS2A 150415278
SG3 SRV-EX0001-IS3A 128057136
SG4 SRV-EX0001-IS4A 40096170
SG1 SRV-EX0001-IS1A 253178200
__________________________
Total = 571746784
The smallest store = SRV-EX0001-IS4A : 40096170
Connection string to this store:
CN=SRV-EX0001-IS4A,CN=SG4,CN=InformationStore,CN=SRV-EX0001,CN=Servers,CN=Amsterdam,CN=Administrative Groups,CN=FSGMS,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=servercare,DC=nl
You'll notice that the verbose mode also shows you what the smallest information store is, and how to connect to that store programmatically in case you would like to add a user to it.
This was added as an 'extra' for those people that have created scripts that help to uniformly create user accounts in their AD, and would also like to fit these accounts with a mailbox. Feel free to use this code, as long as the author information remains mentioned.
Download.
The script can be found here.