jjorgensen626 30 Junior Poster in Training

Hi Everyone,

Wanted to share a bit on this subject as I've had to recently make some of these changes. Along my way I found a few sites that basically suggested moving all mailboxes off the database, dismount, delete and create a new database. Simple enough, however I didn't want to do this.

As you may or may not know, by default Exchange installs the database at the following location:
C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Database1\Database1.edb

Log files would go:
C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Database1

What if you wanted to change the location or name of those files?

Well thankfully this is super easy with powershell.

First let's get the mailbox database name, by using the Exchange Management Shell:

get-mailboxdatabase

The output should look similar to below:

[PS] C:\Windows\system32>Get-MailboxDatabase

Name Server Recovery ReplicationType
---- ------ -------- ---------------
Database1 Server1 False None
Database2 Server1 False None
Database3 Server1 False None
Database4 Server1 False None
Database5 Server1 False None

[PS] C:\Windows\system32>

Now that we can see the name of the database lets work on moving it while simultaneously renaming it. Keep in mind you wouldn't want to do this during non-maintenance hours, as the dismount will not allow users associated with that database access to their email.

dismount-database "database1"

Obvious what this does.

Here is the fun part:

Move-DatabasePath "Database1" -EdbFilePath "G:\ExchangeDBs\NewDatabase\NewDatabase.edb" -LogFolderPath "G:\ExchangeDBs\NewDatabase"

Move-DatabasePath "Database1"
::
we just selected the database

-EdbFilePath "G:\ExchangeDBs\NewDatabase\NewDatabase.edb"
::
Here we edited both the database location AND the name of the database.

Name went from Database1.edb to NewDatabase.edb.

Location went from C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Database1\Database1.edb to G:\ExchangeDBs\NewDatabase\NewDatabase.edb

Fun right?

Now we can check the status of the Database:

Get-MailboxDatabase -Status | select name, mounted

Output should look similar to below:

[PS] C:\Windows\system32>Get-MailboxDatabase -Status | select name, mounted

Name Mounted
---- -------
NewDatabase False
Database2 True
Database3 True
Database4 True
Database5 True

[PS] C:\Windows\system32>

Let's use Powershell to mount the renamed/moved database:

Mount-Database "NewDatabase"

Now we can check the status of the Databases again:

Get-MailboxDatabase -Status | select name, mounted

Output should look similar to below:

[PS] C:\Windows\system32>Get-MailboxDatabase -Status | select name, mounted

Name Mounted
---- -------
NewDatabase True
Database2 True
Database3 True
Database4 True
Database5 True

[PS] C:\Windows\system32>

How can we test our Exchange Server databases to see whether they are online and responding to client requests?

Test-MAPIConnectivity

Output should look similar to below:

[PS] C:\Windows\system32>Test-MAPIConnectivity

MailboxServer Database Result Error
------------- -------- ------ -----
Server1 NewDatabase Success
Server1 Database2 Success
Server1 Database3 Success
Server1 Database4 Success
Server1 Database5 Success

[PS] C:\Windows\system32>

To test one specific database use the -Database parameter.

Test-MAPIConnectivity -Database "NewDatabase"

And there you have it. To rename the Database in the Exchange Management Console, simply go to Organization Configuration: Database Management: Right Click the Database you want to rename: Properties: Change the name of the database on the General tab and press OK. **This will not rename the .edb file name. **