Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
63 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 27

Accepted Solution

by:
MAS earned 2000 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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
LVL 27

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 27

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
How to effectively resolve the number one email related issue received by helpdesks.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

963 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