Solved

Re-instating AD user accounts and mailboxes removed using remove-mailbox -identity "/o=MYORGANISATION/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=USERNAME" -confirm:$false

Posted on 2016-08-01
6
52 Views
Last Modified: 2016-08-26
I mistakenly included a few users in a script  to remove AD user accounts and their mailboxes  remove-mailbox -identity "/o=MYORGANISATION/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=USERNAME" -confirm:$false.

Is there a quick way of getting back these. I know I should use disable instead of remove but I was doing housekeeping on accounts that had been dormant for over a year and wasn't aware how these 3 accounts sneaked in there.

Any help appreciated.
GospodinRasputin.
0
Comment
Question by:GospodinRasputin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 25

Accepted Solution

by:
-MAS earned 500 total points
ID: 41737101
Run the below command to see the mailboxes in the disconnected mailbox.
Get-mailboxdatabase | Clean-MailboxDatabase

Open in new window


If you are running Exchange2013 you have to run
update-StoreMailboxState

Open in new window

https://blogs.technet.microsoft.com/nawar/2014/11/20/clean-mailboxdatabase-and-exchange-2013/

Recover the deleted accounts from AD database
http://social.technet.microsoft.com/wiki/contents/articles/5549.recover-active-directory-deleted-items-using-ldp-exe.aspx
https://technet.microsoft.com/en-us/library/dd379509(v=ws.10).aspx

Then connect the mailbox to the recovered AD users
https://technet.microsoft.com/en-us/library/bb123490(v=exchg.141).aspx
https://technet.microsoft.com/en-us/library/jj863439(v=exchg.150).aspx
0
 

Author Comment

by:GospodinRasputin
ID: 41737225
Hi MAS,
Are you saying that though I used remove and not disable, that the mailboxes are still only disconnected and they can still be gotten back by issuing the Clean-MailboxDatabase commandlet???

Yes, I carried out the removal on a Exchange 2013.
Thanks
0
 

Author Comment

by:GospodinRasputin
ID: 41737227
Also, in your first link above, it says that Update-StoreMailboxState attempts to "to synchronize the mailbox state for a mailbox in the Exchange mailbox store with the state of the corresponding Active Directory user account". In my case, the AD accounts were also removed so there would be nothing to synchronize with.

Please clarify. Thank you
GospodinR
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 25

Expert Comment

by:-MAS
ID: 41737242
This expert suggested creating a Gigs project.
If you delete a user your mailbox still exists in your mailbox server.

if you just want mails. you can restore that mails by connecting that mailbox to another user.
Explained here
https://technet.microsoft.com/en-us/library/jj863439(v=exchg.150).aspx
https://www.youtube.com/watch?v=hwEiK_DS0xU
Check this video

Thanks
0
 

Author Comment

by:GospodinRasputin
ID: 41737245
Sorry you misunderstood me.
By using the remove commandlet on Exchange 2013, i delete both the mailbox and the user account from AD.

I did not simply delete my user account from AD.
Thanks
0
 
LVL 25

Expert Comment

by:-MAS
ID: 41737297
Remove-Mailbox -Identity mymailbox -Permanent $true
This command will delete the mailbox permanently
If you dont use this "-permanent" switch your mailbox will retain for 30days by default.

if you want immediately show the disconnected mailboxes run the below command.
Get-MailboxStatistics -Database database1 | Where { $_.DisconnectReason -ne $null } | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }

Open in new window

Change the database name

Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question