How to purge emails

this only apply for exchange on-prem, can be exchange 2010, 2013 or 2016

Search-Mailbox tony@tonyexchange.com -SearchQuery ‘from:”brannon@companyx.net” subject:”December Unpaid Invoice” sent:10/11/2017’ -TargetMailbox “Exch Admin” -TargetFolder “Purged01″ -LogLevel full

The switches –LogLevel full mean that the result of the search will be copied to the folder Purged01 into the mailbox Exch Admin.

If we don’t want to copy put the switches -LogLevel full –logonly and the end of the above command.

Example:

Search-Mailbox tony@tonyexchange.com -SearchQuery ‘from:”brannon@companyx.net” subject:”December Unpaid Invoice” sent:10/11/2017’ -TargetMailbox “Exch Admin” -TargetFolder “Purged01″ -LogLevel full –logonly

If we want to delete the content just put the switch –DeleteContent.

Example:

Search-Mailbox tony@tonyexchange.com -SearchQuery ‘from:”brannon@companyx.net” subject:”December Unpaid Invoice” sent:10/11/2017’ –DeleteContent.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s