3

Does anybody know why this command is not recognized in Exchange 2010 SP1:

Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -DeleteContent
RPS
  • 1,401
  • 8
  • 19
  • 32

4 Answers4

11

This problem happens because your account is not a member of the Discovery Management role. Since your account does not have permission to perform searches, Powershell does not import the Search-Mailbox cmdlet.

In ECP, add the account to this role, then close and restart your Powershell session.

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
flakshack
  • 720
  • 8
  • 8
0

Create "Mailbox Import-Export Management" role group and grant yourself as a member. Rerun Search commands and it will work.

To create the role group we need to run the following: New-RoleGroup "Mailbox Import-Export Management" -Roles "Mailbox Import Export"

Adding a user can be done by running the following: Add-RoleGroupMember "Mailbox Import-Export Management" -Member

http://blogs.technet.com/b/nawar/archive/2010/06/24/permissions-to-import-or-export-mailbox-data-in-exchange-2010.aspx

0

Are you running this from the Exchange Management Shell? If you're running from a regular powershell instance, did you remember to import the module? Run get-module to find the name of the exchange module, then run import-module <modulename> to make the commands available.

x0n
  • 51,312
  • 7
  • 89
  • 111
0

I used the following to fix the problem: http://www.techieshelp.com/delete-mail-from-multiple-mailboxes/

RPS
  • 1,401
  • 8
  • 19
  • 32