Friday, August 8, 2008

Exchange2007:Export-Mailbox -DeleteContent

www.1ask2.com
A virus message was delivered to all mailboxes in server1. The subject is "I Love You!"

How can you delete it from the Exchange management shell?

get-mailbox -Server tlc25 I Add-MailboxPermission -AccessRights 'FullAccess' -User Administrator -confirm $false

New-Mailbox -Name 'Temp1' -Alias 'Temp1' -UserPrincipalName 'Temp2@TLCTest.local' -SamAccountName 'Temp1' -FirstName 'Temp1' -LastName '' -Database 'TLC25\First Storage Group\Mailbox Database'

get-mailbox -Server Tlc25 I Export-Mailbox -includefolders \inbox -SubjectKeywords 'I love you!' -TargetMailbox temp1 -TargetFolder virus -DeleteContent -confirm:$false

get-mailbox -Server tlc25 I Remove-MailboxPermission -AccessRights 'FullAccess' -User Administrator -confirm $false

======
DeleteContent
---delete the content from the source mailbox after it has been exported to a folder. The source folder will not be deleted.