Enumerating Disconnected Mailboxes

Posted: March 27, 2010 in Active Directory, Exchange Server, Server, System Information
Tags: ,

Problem

You want to enumerate all disconnected mailboxes on a server.

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 for which you want to view disconnected mailboxes.

  3. In the right pane, scroll down through the list, taking note of all mailboxes with a small red circle with an X.

Using VBScript
	' This code enumerates disconnected mailboxes.
	' ------ SCRIPT CONFIGURATION ------
	strComputer = "<Exchange Server>" 'e.g. ExchServer2
	' ------ END CONFIGURATION ---------
	set objWMI = GetObject("winmgmts:\\" & strComputer & _
	                       "\root\MicrosoftExchangeV2")

	set objDiscMbx = objWMI.ExecQuery("Select * from Exchange_Mailbox",,48)
	for each objMbx in objDiscMbx
	  if (objMbx. 
DateDiscoveredAbsentInDS <> "") then
	     Wscript.Echo objMbx.MailBoxDisplayName & " " & _
	                  objMbx.DateDiscoveredAbsentInDS
	  end if
	next
	Wscript.Echo "Successfully enumerated disconnected mailboxes."

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 to as orphaned or disconnected. This recipe shows you how to enumerate the disconnected mailboxes you have on a specified server.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s