There are a litany of issues that will cause Exchange setup to fail when you try to uninstall an Exchange server. It’s really tempting to just skip the uninstall and go delete the server entry from AD using something like ADSI Edit, but, you’re always better off just fixing the problem. Michael B. Smith has a good review of these, however I thought I’d touch on one more, specifically the error "One or more users currently use a mailbox store on this server". This can be really frustrating, especially when you’ve checked each mailbox store for mailboxes and done a search using AD Users and Computers for mailboxes on that server and turned up nothing. Exchange setup is doing a search of AD for users who have a msExchHomeServerName value which is equal to the legacyExchangeDN of the server you’re trying to remove.
There’s a handy KB article, 924170, which suggests a mechanism to find the problem users, but, my experience tonight is that the directions don’t really actually work. The good news this is really easy to straighten out with adfind and possible admod. What you want to do is two-fold. First, find the legacyExchangeDN of the server you’re trying to remove. You can do this with adfind:
adfind -config -f "cn=SOME-SERVER" legacyExchangeDN
You should get a result something like this:
/o=Brian Lab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=BRIAN-XMB01
What you’ll want to do now is find all the users who reference this value in their msExchHomeServerName attribute:
adfind -gcb -f "msExchHomeServerName=/o=Brian Lab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=BRIAN-XMB01"
If there’s only a few results, the easiest solution is to just find each user using AD Users and Computers on a machine with Exchange System Manager installed, right click the user, select Exchange Tasks, and then use the Remove Exchange Attributes option.
If there’s a lot of users, you’ll probably want a more automated solution. You can use adfind with admod to clear the msExchHomeServerName attribute on a lot of users at once.
adfind -gcb -f "msExchHomeServerName=/o=Brian Lab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=BRIAN-XMB01" -adcsv | admod -unsafe msExchHomeServerName:-: