• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1831
  • Last Modified:

Error running Search-Mailbox Query Exchange Management Shell

I am trying to run a powershell commandlet from the Exchange Management shell, I have Exchange 2010.

This is the command:
Search-Mailbox -Identity "<user>" -SearchQuery 'Subject:"<subject_title>"' -DeleteContent

my respoinse is always:

A positional parameter cannot be found that accepts argument '-DeleteContent'.
    + CategoryInfo          : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox

I do not know what I am doing wrong. All  my research suggests that this should work.
0
sattermc
Asked:
sattermc
1 Solution
 
J SSenior Systems AdministratorCommented:
Have you assigned the account running this command the "Mailbox Import Export" role?
0
 
David Paris VicenteSystems and Comunications Administrator Commented:
Hi sattermc.

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.
0
 
sattermcAuthor Commented:
The problem was the "Mailbox Import Export" role.

Thank you both.
0

Featured Post

Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now