Exchange 2010: How to Remove Specific Recurring Items from Terminated User Calendar?

One of the prevalent requests we receive is to remove recurring meetings / appointments from room mailboxes which were created by user's who no longer exist within the organization.  The problem we're having: when a user is terminated, within a week, their mailbox data is exported and then the mailbox is removed from the database.  As it always seems to go, we receive the requests only after the mailbox no longer exists.  To that end, I have two questions:

1) After the user is terminated and the mailbox is removed from the database, are there any feasible options to remove the orphaned calendar items?  If so, how can this be accomplished?  I am unable to find a supported solution.

2) If the first question isn't an option, I'll need to put onus on the manager to whom the user reported; to provide us with specific meetings / appointments that need to removed.  Without re-enabling the mailbox, is there a feasible option to remove specific calendar items from the terminated users' calendar?  If so, how can this be accomplished?

Any assistance would be very helpful as I've been unable to locate any supported / unsupported options.

Thanks!
LVL 1
DrivelFreeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sumit GuptaSystem and Virtualization EngineerCommented:
three commands to clean up old orphaned calendar items:

Command 1:

Export-Mailbox -Identity <user alias> -SenderKeywords “deleted_user@company.com” -IncludeFolders “\Calendar” –DeleteContent

This command will delete all calendar appointments originating from the deleted user in a single target mailbox using that deleted user’s email address. This will ensure that only calendar appointments from that user will be deleted since we’re A) using a unique string to identify the appointments and B) specifying the Calendar folder. Be careful if you’ve added the departed user’s email as an alias to another account because I didn’t test that and I am not sure what those results would be.

Command 2:

Get-Mailbox | Export-Mailbox -SenderKeywords “deleted_user@company.com” -IncludeFolders “\Calendar” –DeleteContent

This command will delete calendar appointments originating from the deleted user in every mailbox, in the unlikely event they were meeting happy.

Command 3:

Get-Mailbox -Filter {CustomAttribute14 -eq ‘ResourceMB’} | Export-Mailbox -SenderKeywords “deleted_user@company.com” -IncludeFolders “\Calendar” –DeleteContent

I borrowed the filter portion of my last post in this command to delete the appointments originating from the deleted user in every mailbox whose Custom Attribute 14 is set to ResourceMB. I went ahead and entered this custom attribute for every conference room, projector, and video cart we have so that I can clean them all up with one command.

You can also use the –TargetMailbox parameter to redirect items to a separate mailbox instead of delete them in the event of a disaster. The full list of parameters for TargetMailbox is located here.

Quick note.  I ran into a scenario where the user’s account was already deleted, so when I would run the command, it didn’t do any clean up.  When I checked the appointment, I saw that the user had ‘No e-mail address exists for this person’ in the properties in Outlook.  Since this was the case, the command using the email address obviously didn’t work.  I replaced the email address with the displayed user name in the appointment and it worked like a champ.  The modified command looked something like this:

Get-Mailbox -Filter {CustomAttribute14 -eq ‘ResourceMB’} | Export-Mailbox -SenderKeywords “Lastname, Firstname” -IncludeFolders “\Calendar” –DeleteContent

Be sure to get the ‘Lastname, Firstname” value from what is displayed in the orphaned appointment.
0
DrivelFreeAuthor Commented:
Unfortunately, the Export-Mailbox command will only work with Exchange 2007.
0
Sumit GuptaSystem and Virtualization EngineerCommented:
There is already solved case in Expert-Exchange. Check this link: http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_27911885.html

------------------------------------------------------------------------------------------
As a workaround you can try restoring the mailbox temporarily from backup and send the cancellation.

Or If the subject of the meeting is unique then you may use search-mailbox command to remove the calendar items from user mailboxes.
Ref :http://technet.microsoft.com/en-us/library/dd298173.aspx

Search mailbox will search all folder in mailbox and remove contents, so first run the search with –logonly and check the logs and if you are fine to delete the items in result then use -loglevel full –DeleteContent to delete he items. If you know the attendee list then you can narrow the search with in attendee mailboxes. Following are the Examples on how to search and delete items from single or multipple mailboxes.

To search in single mailbox
search-mailbox -identity userA -searchquery "Kind:meetings and Subject:Subject of meeting and from:User@domain.com" -targetmailbox Adminmailbox -TargetFolder "SearchData" -logonly -loglevel full

To delete items from Single mailbox
search-mailbox -identity userA -searchquery "Kind:meetings and Subject:Subject of meeting and from:User@domain.com" -targetmailbox Adminmailbox -TargetFolder "SearchData" -loglevel full -DeleteContent

To search items for all mailboxes
Get-Mailbox -ResultSize Unlimited | search-mailbox -searchquery "Kind:meetings and Subject:Subject of meeting and from:User@domain.com" -targetmailbox Adminmailbox -TargetFolder "SearchData" -logonly -loglevel full

To delete items from all mailboxes
Get-Mailbox -ResultSize Unlimited | search-mailbox -searchquery "Kind:meetings and Subject:Subject of meeting and from:User@domain.com" -targetmailbox Adminmailbox -TargetFolder "SearchData" -loglevel full –DeleteContent
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pavan JoshiCommented:
Can you give some examples in the command?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.