office365-mail-purger/README.md
2023-08-26 15:08:29 +02:00

28 lines
1.2 KiB
Markdown

# Office 365 email purger
This PowerShell script will use Compliance Search to purge all content older than a specified date involving one or more specified users from all mailboxes in an Office 365 tenant.
## Usage
1. Download the script and save it to your computer.
2. Edit the script and change the following lines to match your environment:
```powershell
$Addresses = @("user@example.com", "user2@example.com")
$MaxDate = "2016-01-01"
```
3. Run the script. You will be prompted for your Office 365 credentials.
4. Get a cup of coffee, and then another. This script will take a while to run. As in, hours or days, depending on the size of your organization.
## Notes
* This script will delete all content older than the specified date, including items in the user's mailbox that were sent to or received from other users in the organization.
* The larger your organization, the longer this script will take to run.
* This is quite a dangerous script. Use it at your own risk.
* This script may delete more or less than you expect.
* The script is provided as-is. I am not responsible for any damage caused by running it.
## License
This script is licensed under the [MIT License](LICENSE).