17.14. Reconnecting a Deleted Mailbox

Problem

You want to reconnect a mailbox in the Exchange Store to a user object.

Solution

Using a graphical user interface

  1. Open the Exchange System Manager (ESM) snap-in.

  2. In the left pane, browse to the mailboxes container of the server, storage group, and database where you want to reconnect a mailbox.

  3. In the right pane, scroll down until you find the mailbox you wish to reconnect. The mailbox should have a small red circle with a white X on it indicating it is disconnected.

  4. Right-click the mailbox and select Reconnect.

  5. Choose a user object in the directory you wish to reconnect this mailbox to.

  6. A dialog box indicating the Reconnect Operation has completed successfully should pop up. Click OK.

Using VBScript

' This code reconnects a mailbox to a user.
' ------ SCRIPT CONFIGURATION ------
strComputer = "<Exchange Server>" ' e.g., ExchServer2
strUser = "<Userid>"              ' e.g., jsmith
strMailbox = "<Mailbox Alias>"    ' e.g., jsmith
' ------ END CONFIGURATION ---------
   
set objWMI = GetObject("winmgmts:\\" & strComputer & _
                       "\root\MicrosoftExchangeV2")
set objDiscMbx = objWMI.ExecQuery("Select * from Exchange_Mailbox WHERE " _
                           & "MailboxDisplayName='" & strMailbox & "'",,48)
for each objMbx in objDiscMbx
  objMbx.Reconnect strUser
next
Wscript.Echo "Successfully reconnected mailbox."

Discussion

When you tell the system to delete an Exchange mailbox, it isn't really deleted. It is simply disassociated or disconnected from the user object. These mailboxes are referred ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.