Link to home
Start Free TrialLog in
Avatar of neil4933
neil4933

asked on

Locate disconnected mailbox in Exchange

Hi

I asked this question here: https://www.experts-exchange.com/questions/26953774/Locate-disconnected-mailbox-in-Exchange.html

But just realised that I didn't get the full answer I was looking for! I need to know how to run the commands only on US servers.

>>

Sometimes our support teams accidentally delete the wrong AD account when users leave our company and their mailboxes are set to a 'disconnected' state within our Exchange 2007 environment.

In order to find them again, we need to locate the disconnected mailbox from Exchange. This has two issues:

1. We need to run the 'clean-mailboxdatabase' command to update the names of disconnected mailboxes in a particular db
2. We can only search by each mailbox db in turn

I would like to do the following

a) Run a command that would run clean-mailboxdatabase on all US Exchange servers
b) Run a command that would 'get' all disconnected mailboxes on US Exchange databases

Our Exchange servers are named in the format, region-mbx1, e.g. US-Mbx1, EMEA-Mbx1, APAC-Mbx1.

Does anyone know how I can do this?

Secondly, is there a disadvantage to running clean-mailbox on all databases on a given server at the same time?

>>
Avatar of Exchange_Freak
Exchange_Freak
Flag of India image

I have not tried it but see if you can run the command as Get-ExchangeServer | Get-MailboxDatabase | Clean-Mailboxdatabase
Avatar of neil4933
neil4933

ASKER

Sure, but I only want to run the Clean Mailbox on US servers?

And do you know how I'd find disconnected mailboxes only on US servers?
Get-Exchangeserver "Names of the US Servers" | Get-MailboxDatabase | Clean-MailboxDatabase
Avatar of Chris Dent
You should be able to see disconnected mailboxes using Get-MailboxStatistics (probably have to target the database name). Sorry I can't give you a specific example right now, won't be at work until Thursday.

Chris
Even though you dont run the cleanup script, the mailbox will get disconnected in 2 to 3 hours usually.

Here is a nice oneliner to get the disconnected mailboxes using powershell and wmi.

http://exchangeservertips.com/exchange-2010/powershell-script-to-identify-disconnected-mailboxes/

Good luck
Shaba
That'll only work for 2003, not for 2007 / 2010, the WMI interface was introduced (mostly) for 2003, then stripped out again for 2007.

Chris
ASKER CERTIFIED SOLUTION
Avatar of GusGallows
GusGallows
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can go a step further to make it where you can see which server they are on by adding a few additional lines:
#create an array of all US mailbox servers and then iterate through them one at a time.
$Servers = get-exchangeserver | where {($_.Name -like "US*") -and ($_.IsMailboxServer -eq $true)}
foreach ($Server in $Servers)
{ 
	#get a list of all databases on the selected server and clean them.
	$mdbs = Get-MailboxDatabase -Server $Server
	foreach ($mdb in $mdbs)
	{
		Clean-MailboxDatabase $mdb
	}
	#get a list of all disconnected mailboxes on the selected server.
	$mbs = Get-MailboxStatistics –Server $Server | Where-Object {$_.DisconnectDate –notlike ‘’}
	$server
	$mbs
}

Open in new window