Velocity Technical Archive
Searching Exchange 2010 mailboxes with Powershell
Archived Reference: This is a historical technical article preserved from the Velocity Technologies knowledge base. For current Phoenix and East Valley managed IT services, explore our managed IT services or cybersecurity solutions.
#Assign the role to the required user account\nNew-ManagementRoleAssignment -Role "Mailbox Import Export" -User administrator\n#Restart the shell\n#This would search every mailbox for messages containing the word secrets in the message body,\n#and export them to the administrator mailbox in a subfolder called Export\nGet-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery "Body:'*secrets*'" -TargetMailbox administrator -TargetFolder Export\n#Or, to search one mailbox for bob smith\nSearch-Mailbox -Identity bsmith -SearchQuery "Body:'*secrets*'" -TargetMailbox administrator -TargetFolder\n#you can also do this via ECP\n#see http://technet.microsoft.com/en-us/library/dd298014.aspx