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
51 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
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
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

830 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