Deleting a Message from all Mailboxes in Exchange Online
Lendo o blog do time da MessageOps encontrei um artigo muito interessante, que fala de um script para deletar assuntos espeficicos das mailbox. Confira o artigo abaixo:
Anyone who has administered Exchange knows there are times when you need to go through all the mailboxes and delete a message with a certain subject. Common examples include:
- Virus Outbreak
- Disgruntled employee sending one last email
- Sensitive email accidently sent to incorrect recipients
Another scenario which is somewhat new with hosted environments is someone accidently sends a large email to a large number of people, resulting in a spike in Internet traffic as everyone downloads the message to their OST. Administrators need some way to quickly get into the mailboxes and remove the message to stop the downloads.
Since there doesn’t appear to currently be a way to handle the above scenarios with Exchange Online, we decided to do something about it! The script below searches through all your enabled mailboxes for a message with the subject specified, which was received within the last 4 hours. If a message with the specified subject is found the script deletes the message.
Of course you need to be very careful with this script as it has the potential to cause big problems if run incorrectly. By default the script runs in Test Mode, where only a single mailbox is processed. If you take the script out of test mode, all enabled mailboxes will be searched.
This script requires that you have the EWS Managed API, which can be downloaded here.
If you have any questions, need customizations, have suggestions, or need assistance, please email us at email@example.com . We are constantly looking for new script ideas, so if you have a need for a script or Microsoft Online application, please let us know.
We can’t stress enough that since the script does delete messages, you need to be careful with it. MessageOps will not be responsible for any problems resulting from its execution in your environment.