Summary:

This script is an example of quickly searching an environment for mailbox numbers per database using LDAP queries.  This method can speed up searches for small amounts of data from a large set of mailboxes.

This script will output a CSV of the database name and mailbox count associated with each database.  The CSV file can be easily imported back into the management console with Import-CSV.

The following information is available in the CSV:
- Database Name
- Associated Mailbox Count

Examples:

The first example will execute a search for databases matching the pattern *VIP* and output the data to a file called VIPDatabases.csv in the current working directory.  The second example will execute a search for databases matching DAG-1* and will export to the default CSV (DatabaseBreakout.csv).

PowerShell
Edit|Remove
.\MailboxCountPerDatabaseLDAP.ps1 -DatabaseFilter *VIP* -LogFileName VIPDatabases.csv
PowerShell
Edit|Remove
.\MailboxCountPerDatabaseLDAP.ps1 -DatabaseFilter DAG-1*