Learn Exchange the Guru way !!!


Exchange 2016/2013: Domain Provisioning & Database Creation Automation

We all love PowerShell to do automation. It is always great to have a script which can pick up the details from an excel CSV file and do the rest.


I have done the same on this blog which is going to share 2 scripts and an excel file.

This can be widely used in an Exchange hosted setup.


Let me walk through the steps:

Step 1: Download the scripts and NewDB.CSV from the Microsoft Gallery link mentioned below:

Exchange 2013/2016 On-Premises New Email Domain and Database Provisioning Script

Exchange 2016/2013 On-Premises Database Copy Provisioning Script

NewDB.csv is identical on both links so download anyone will work.


Step 2: Move all 3 files to the C:\temp folder which is configured as a path in the script.


Step 3: Open the excel file and fill all the fields as per your setup and requirement. Then save and close the file.

AP stands for ActivationPreference


Step 4: Ensure that you are in the change window because this script will move the active database to the other server.


Step 5: Open the DomainProvisioning.PS1 and see if you need to edit any configuration. Every setup is different so you might need to change it.

This script will do the following:

1. Create new accepted domain as authoritative. You can change from authoritative to any relay you need in the PS1 script

2. Create new Global address list, Address List and Room Address List with customattribute2

3. Create new Offline address book.

4. Create new Address Book Policy.

5. Create new mailbox database

6. Restart Information Store Service

7. Update the quota of the newly created database.


Step 6: Open Exchange management Shell and change the path to C:\temp

Then execute the PowerShell script.

.\ DomainProvisioning.PS1


Step 7: Once finished, Verify all the creation and preview (where available) of the following:

1. Accepted domain

2. Global address list, Address List, and Room Address List

3. Offline address book.

4. Address Book Policy.

5. Mailbox database and quota


Step 8: Check the database and indexing health with the queue length by running the following command

Get-MailboxDatabaseCopyStatus *\*


Step 9:
Open the DBCopyProvisioning.ps1 and see if you need to edit any configuration. Every setup is different so you might need to change it.

This script will do the following:

1. Create a copy of the mailbox database

2. Restart Information Store Service

3. Redistribute the databases as per the activation preferences.


Step 10: Execute the 2nd script to create another copy of the database



Step 11: Verify the database copy has been created and it is healthy by running the below-mentioned command:

Get-MailboxDatabaseCopyStatus *\*


Prabhat Nigam

Microsoft MVP | CTO @ Golden Five


Leave a Reply




Do NOT follow this link or you will be banned from the site!