Thursday, June 19, 2014

Exchange 2013 - removing mailbox databases

At some point, we may want to remove a mailbox database for various reasons. Exchange 2013 contains a default mailbox database with an automatically generated name. We can either rename this database or create other databases, based on our needs, and then remove the default database.

In Exchange 2013, there are various "system mailboxes" that may prevent removal of the database. In the following lines, I'll show the reader how to identify them and either move or remove them.


First, we'll identify the mailbox databases:

[PS] C:\>Get-MailboxDatabase | select name

Name
----
Mailbox Database 0859128749
EXDB-2


So we have the default mailbox database and EXDB-2 which I created after installation.

I want to remove "Mailbox Database 0859128749"

There are a couple options for the syntax. I'll use a variable for this:

[PS] C:\>$def = Get-MailboxDatabase "Mailbox Database 0859128749"

Now, if I attempt to remove the mailbox database, this is what happens:

[PS] C:\>Remove-MailboxDatabase $def

This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes [...].

(The message is quite long so I have not posted all of it.)

So now, I'll move or remove those various forms of mailboxes so we can later delete the mailbox database itself.



Mailboxes

First, we'll list the "simple" mailboxes (as opposed to system mailboxes) present in the mailbox database:

[PS] C:\>Get-Mailbox -Database $def | select name

Name
----
Vik.Kirby
DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB852}


Concerning the Discovery Search Mailbox, it is used for discovery searches related to compliance, for example. We have the option to move it or delete it. Since I've just installed Exchange (and have not performed any searches) I'll simply delete it:

[PS] C:\>Get-Mailbox "DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB852}" | Remove-Mailbox


There is a prompt for confirmation stating that the command "will remove the Active Directory user object and mark the mailbox and the archive (if present) in the database for removal." That is OK.

I can move the other mailboxes with this cmdlet:

[PS] C:\>Get-Mailbox -Database $def | New-MoveRequest -TargetDatabase EXDB-2

I can observe the progress of the move with the Get-NewRequest cmdlet: Queued, InProgress, Completed:

[PS] C:\>Get-MoveRequest | fl Displayname,status

DisplayName : Vik Kirby
Status      : Completed


Mailbox Plans

The error message mentioned above states:

"To get a list of all mailbox plans in this database, run the command Get-MailboxPlan."

But apparently, there is no such cmdlet:


[PS] C:\>Get-MailboxPlan

Get-MailboxPlan : The term 'Get-MailboxPlan' is not recognized as the name of a cmdlet, function, script file, or operable program.

[PS] C:\>gcm Get-MailboxPlan

gcm : The term 'Get-MailboxPlan' is not recognized as the name of a cmdlet, function, script file, or operable program.

Note: "gcm" is an alias for the Get-Command cmdlet.

[PS] C:\>gcm *plan* | select name

Name
----
Get-UMDialPlan
New-UMDialPlan
Remove-UMDialPlan
Set-UMDialPlan

Note: my research indicates that "mailbox plans" only exist in a hosted (or hybrid?) environment. Since that is not my case, I'll ignore that step and proceed to the next.


Archive mailboxes

Mailbox users may have archive mailboxes associated with their ordinary (or "regular") mailbox.

Here is how we could identify these mailboxes:

[PS] C:\>Get-Mailbox | where archivedatabase -eq $def



As we can see, there are no archive mailboxes present.

If there were such mailboxes, I could pipeline the results to the New-MoveRequest cmdlet to move them:

New-MoveRequest -ArchiveOnly -ArchiveDatabase "Target Mailbox Database"



Public Folder mailboxes

In Exchange 2013, public folders are now incoporated in the mailbox databases (there are no longer separate public folder databases).

[PS] C:\>Get-Mailbox -Database $def -PublicFolder
[PS] C:\>

I have none in the default mailbox database. Otherwise, they would be moved like other mailboxes.



Arbitration mailboxes


[PS] C:\>Get-Mailbox -Database $def -Arbitration | fl name

Name : SystemMailbox{1f05a927-715a-4a1b-80e0-a024dc8ff0f4}
Name : SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}
Name : SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}
Name : Migration.8f3e7716-2011-43e4-96b1-aba62d229136
Name : FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042


Do I need to move these? Are there comparable mailboxes in the target mailbox database?


[PS] C:\>Get-Mailbox -Database EXDB-2 -Arbitration
[PS] C:\>

No... so I will move them:

[PS] C:\>Get-Mailbox -Database $def -Arbitration | New-MoveRequest -TargetDatabase EXDB-2


Removing the database

Now that all the mailboxes have been removed from the database, we can remove the database itself. We can use either the Exchange Admin Center (EAC) or the EMS. I'll use the latter option:

[PS] C:\>Get-MailboxDatabase "Mailbox Database 0859128749" | Remove-MailboxDatabase

Confirm
Are you sure you want to perform this action?
Removing mailbox database "Mailbox Database 0859128749".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): A

We have to confirm the operation (above) and an error message displays:

WARNING: Failed to remove monitoring mailbox object of database "Mailbox Database 0859128749". Exception: Active Directory operation failed on DC2.mynet.lan. This error is not retriable. Additional information: Access is denied.
Active directory response: 00000005: SecErr: DSID-031520B2, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0

However, this error does not prevent the deletion of the database:
.
WARNING: The specified database has been removed. You must remove the database file located in C:\Program Files\Microsoft\ExchangeServer\V15\Mailbox\Mailbox Database 0859128749\Mailbox Database 0859128749.edb from your computer manually if it exists. Specified database: Mailbox
Database 0859128749

We can manually delete this file (and the associated log files) as we would delete any other files.

Monday, June 16, 2014

Exchange 2013 (SP1) - Migration - Part 10 - verifications and removal of Exchange 2007

Even after successful mailbox migration, we may want to maintain the Exchange 2007 server online to ensure that everything is working fine.

After a month or so (or whatever time frame is deemed appropriate), the server can be removed.

In my case, I'll remove it now - or after some verifications.


***

Mail and mailboxes

I have ensured that mail can be sent and received both internally and externally (to and from external recipients).

I have ensured that users can access their mailbox with both Outlook and OWA (those with smart phones would want to test ActiveSync).

I have run the following cmdlet to verify that all mailboxes have been moved:

[PS] C:\>Get-Mailbox -Server EX1
[PS] C:\>
[PS] C:\>Get-Mailbox -Server EX13-1 | select -first 3

Name                      Alias                ServerName       ProhibitSendQuota
----                          -----                ----------         -----------------
Administrator            admin                 ex13-1             Unlimited
Alex.Heyne               Alex.Heyne        ex13-1             Unlimited
Ella.Amaral               Ella.Amaral         ex13-1            Unlimited


No mailboxes remain on EX1 (the Exchange 2007 server). All have been migrated to EX13-1 (for concision, I only displayed the first three).


Address Lists

We should note, in the EAC (organization section), that several address lists are not "up to date". We also can read in the right pane (not shown in the screenshot below) that "This address list was created using the Exchange Management Shell. Use Exchange Management Shell to modify it."



So I go to the EMS and run the following commands:

[PS] C:\>Get-EmailAddressPolicy | Update-EmailAddressPolicy
[PS] C:\>Get-GlobalAddressList | Update-GlobalAddressList
[PS] C:\>Get-AddressList | Update-AddressList


Now, if we look at the page above, the "up to date" status is changed to "Yes" for all categories:




Offline Address Book (OAB)

Once again, mailbox users, both migrated users and test users created directly on the Exchange 2013 server, can send and receive messages.

However, when I attempt to download the OAB in Outlook 2010, I encounter various errors.

At one point, it appeared that there was an attempt to contact the Exchange 2007 server. There was a failure to connect, resolved only when I turned that server back on (it was turned off).

On subsequent attempts however, there was no such delay. Perhaps something was reset when I turned the server on (?).

Otherwise, consistent 0x80190193 errors were encountered (for several users on multiple attempts):



I discovered that this was caused by the SSL settings on the OAB virtual directory. With Exchange 2007, SSL is not required by default. With Exchange 2013, SSL is required for the OAB download. Unchecking the SSL requirement (and running iisreset /noforce at the command prompt) resolved this problem.

Users were able to consistently download the OAB after that. There was one 0x8004010F error but not on the second (and following) attempts.




One remark: since no OAB is designated for the mailbox database or the individual users, and since an OAB is apparently downloaded, I conclude that the default OAB is used even if it is not explicitly indicated:

[PS] C:\>Get-Mailbox | select -first 3 | fl name,*offl*

Name               : Administrator
OfflineAddressBook :

Name               : Alex.Heyne
OfflineAddressBook :

Name               : Ella.Amaral
OfflineAddressBook :

Note: I only show the first 3 but no other user has a designated mailbox either.

[PS] C:\>Get-MailboxDatabase | fl *off*

OfflineAddressBook :



Exchange 2007 uninstall

At this point, we can uninstall Exchange 2007.

First, we need to remove:

- The Exchange 2007 Offline Address Book
- Mailbox Databases (only one in my case)
- Storage Groups (once again, only one in my case)
- EX1 as a source server for the Send Connector (EX1 is the Exchange 2007 server)

Then we can uninstall Exchange 2007 in "Programs" (formerly Add/Remove programs).

Here are those steps in greater detail...

First, in the EMC of the Exchange 2007 server, I highlight the "Default Offline Address Book", right-click and select "Remove":




Note: this is at the Organization level, Mailbox Role section.

I used the EMC above but we could use the EMS:

Get-OfflineAddressBook "Default Offline Address Book" | Remove-OfflineAddressBook

Note: since I already removed the OAB with the EMC, I was not able to test this cmdlet but I believe the syntax is correct.

Next, I'll remove the mailbox database:


Note: this is at the Server level of the EMC, Mailbox section.

Here is the EMS command-line option:

[PS] C:\>Get-MailboxDatabase MBXDB1 | Remove-MailboxDatabase

Note: we can first run "Get-MailboxDatabase" alone to determine the name of the mailbox database.


Now I'll remove the Storage Group (same location as mailbox database):



Here is the EMS equivalent:

[PS] C:\>Get-StorageGroup SG1 | Remove-StorageGroup

When we remove the mailbox database and storage group, we are asked to confirm the operation and informed that the database and log files must be deleted manually:

WARNING: The specified database has been removed. You must remove the database file located in C:\SG1DB1\MBXDB1.edb from your computer manually if it exists. Specified database: MBXDB1

WARNING: The specified storage group has been removed. You must remove the log file located in C:\SG1LOGS from your computer manually if it exists. Specified storage group: ex1\SG1.

At this point, I attempted to uninstall Exchange 2007:



I click "Next" as needed and then uncheck all the server role and management tool options on this page:



However, I forgot something (to remove EX1 - the Exchange 2007 server - as one of the source servers for the organization-wide Send Connector). Consequently, the Readiness Check for the Hub Transport role fails:




I correct this by removing EX1 from the Send Connector source servers:



Here is the command line option:

[PS] C:\>Get-SendConnector | fl name,sourceTransportServers

Name                   : MYNET-SendConn-1
SourceTransportServers : {EX13-1, ex1}

[PS] C:\>Set-SendConnector MYNET-SendConn-1 -sourceTransportServers EX13-1
[PS] C:\>
[PS] C:\>Get-SendConnector | fl name,sourceTransportServers


Name                   : MYNET-SendConn-1
SourceTransportServers : {EX13-1}


If I attempt the uninstall now...


all the Readiness Checks pass and ultimately the uninstall process is successful.