Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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
?
61 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 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
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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…
Suggested Courses

721 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