Error reconnecting user mailbox

On a disconnected mailbox - I get the following error:

Summary: 1 item(s). 0 succeeded, 1 failed.
Elapsed time: 00:00:06

Stafford, Troy

The LegacyExchangeDN "/O=AUBURNSD/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=TSTAFFORD" of "3c0a6c23-b053-454a-8219-006fa8c9fec8" is being used by the following user in Active Directory: "Stafford, Troy". The value for LegacyExchangeDN must be unique to each user.

Exchange Management Shell command attempted:
Connect-Mailbox -Identity '3c0a6c23-b053-454a-8219-006fa8c9fec8' -Database '\MBX Storage Group 01\MBX01' -User 'asd\z10' -Alias 'z10'

Elapsed Time: 00:00:06

How do I fix this?  I tried reconnecting it to a generic user without the same name just to get it "active" again but it still fails.  How can I fix it or assign a different LegacyExchangeDN?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James MontgomeryCommented:
Does the original mailbox owner (Stafford, Troy) still exist in AD?
jenmilksAuthor Commented:
No user doesn't exist.  Tried re-creating it and reconnecting but it gives this error, I don't know why.

I see the tool, but it seems to change things across the whole Exchange site, I don't want to do that, just this one mailbox.  Will this tool do that?
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

James MontgomeryCommented:
The only reason I can think of the error message is that the legacyexchangeDN is still in AD for a user account

If you are ok with scripting i have written a script to enumerate all exchange legacyDNs for all users

Save as vbs file - may need to be run from exchange server (tested with exchange 2003).

Change Set domainObject = GetObject("LDAP://OU=someOU,DC=somedomain,DC=ad") to reflect the topmost container for your AD.

It will produce a file with all legacyDNs, you can the search and find for the one in the error and see if it still exists somewhere.
Option Explicit
Dim fs
Dim UserFile
Dim rootDSE, domainObject
Set domainObject = GetObject("LDAP://OU=someOU,DC=somedomain,DC=ad")
Set fs = CreateObject ("Scripting.FileSystemObject") 
Set userFile = fs.CreateTextFile ("AddressList.csv")
on error resume next
Wscript.Echo "Finished"
Sub ExportUsers(oObject)
Dim oUser
  For Each oUser in oObject
	Select Case oUser.Class
		Case "user"
			Wscript.Echo "Object User= " & oUser.Get("distinguishedName")
			Dim UserOUPath
			Dim ln
			Dim userdn
			Dim mail
			userdn = oUser.Get("distinguishedName")
			ln = (Len(userdn) - Len("CN=" & oUser.Get("cn"))) - 1
			UserOUPath = Right(userdn, ln)	
			Wscript.Echo UserOUPath
			if oUser.mail <> "" then
				on error resume next
				userFile.WriteLine oUser.Get("LegacyExchangeDN")			
			end if
		Case "organizationalUnit", "container"
			Wscript.Echo "Object OU= " & oUser.Get("distinguishedName")
	End select
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jenmilksAuthor Commented:
Thanks for this, this is Exchange 2007 and the script doesn't appear to run.

I appreciate your time.
jenmilksAuthor Commented:
Implementing the script doesn't work for me.  The LegacyDN application doesn't reference Exchange 2007 - didn't find a solution on this one really.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.