Link to home
Start Free TrialLog in
Avatar of Nob Y
Nob Y

asked on

Exchange 2013 - Empty all mailboxes within a database

Hi, I've got 150mailboxes within this database. All the mailboxes are used during a specific period of time per year. By the end of the season, is there a script I can run to empty all the mails in the mailboxes? so when users start again next season there will be no mails left in them.

thanks,
ASKER CERTIFIED SOLUTION
Avatar of M A
M A
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, if you want to completely purge the mailboxes, you can use MAS' suggestion, but without the -SearchQuery parameter:

Get-Mailbox -database #Database# | Search-Mailbox -deletecontent

Open in new window


You will be then prompted to confirm the deletion (to skip this confirmation, run the Search-Malbox command with a -Force switch).

For more on deleting content from mailboxes using Search-Mailbox -DeleteContent see: https://www.codetwo.com/admins-blog/how-to-delete-email-from-mailboxes-on-exchange-2016-2013-2010-online/?sts=6651

Hope this helps,
CodeTwo
Avatar of Nob Y
Nob Y

ASKER

Hi Mas and CodeTwo,

Appreciated the help, let me try the scripts.

Cheers,
Nob
1)
Search-Mailbox -Identity “April Stewart” -DeleteContent

2)
Export-Mailbox -identity “April Stewart” -DeleteContent

Your account must be a member of the group: “Mailbox Import Export”.

Reference : http://technet.microsoft.com/en-us/library/dd298173.aspx
Avatar of Nob Y

ASKER

Thanks for the help, the script worked great.