none
Search-mailbox & -deletecontent

    Question

  • Hello, I have a problem with Serach-Mailbox cmdlet

    when I trying use -DeleteContent switch I have error which looks like:

    [PS] C:\Windows\system32>Search-Mailbox -Identity XXX@XXX.com -searchDumpsterOnly -DeleteContent

    Не удается найти позиционный параметр, принимающий аргумент "-DeleteContent".

    (In english Can't find positioning property for argument -DeleteContent)

    + CategoryInfo : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox

     

    I have Exchange 2010 SP1 and

    get-help  Serach-Mailbox return to me help with -DeleteContent

    What's wrong?

     

    Wednesday, October 27, 2010 8:55 AM

Answers

  • Hi Postman2010,

    "Search-Mailbox -Identity XXX@XXX.com -searchDumpsterOnly -DeleteContent"

    I guess you cannot use "TAB" key to find the parameter "deleteContent".

    If you run the cmdlet Get-ManagementRoleEntry "*\*" -Parameters deletecontent, you can find out only "Mailbox Import Export" Role has the parameter -DeleteContent

    "By default, the Mailbox Import Export management role isn't included in any of the built-in role groups, such as the Organization Management role group."

    Add the Mailbox Import Export Role to a Role Group
    So please assign the role to "search admin" and test again.

    Frank Wang
    • Marked as answer by Postman2010 Wednesday, November 03, 2010 9:05 AM
    Friday, October 29, 2010 9:52 AM

All replies

  • Hi,

    This article might help
    http://technet.microsoft.com/en-us/library/dd298173.aspx

    What is the status of DiscoveySearchMailbox?

    -Gulab

    Wednesday, October 27, 2010 10:47 AM
  • Thank You! I'm already read it! and I try to use examples from this description!

    Search-Mailbox work fine until I'm use -DeleteContent

    every search-query copying to DiscoveySearchMailbox well but if I want -DeleteContent - it shows error.

    It's error looks like error in syntax. but I cant find mistake.

     Shell trying to understand -DeleteContent as argument? what does it mean??

     

     

     

    Wednesday, October 27, 2010 11:54 AM
  • Hi Postman2010,

    "Search-Mailbox -Identity XXX@XXX.com -searchDumpsterOnly -DeleteContent"

    I guess you cannot use "TAB" key to find the parameter "deleteContent".

    If you run the cmdlet Get-ManagementRoleEntry "*\*" -Parameters deletecontent, you can find out only "Mailbox Import Export" Role has the parameter -DeleteContent

    "By default, the Mailbox Import Export management role isn't included in any of the built-in role groups, such as the Organization Management role group."

    Add the Mailbox Import Export Role to a Role Group
    So please assign the role to "search admin" and test again.

    Frank Wang
    • Marked as answer by Postman2010 Wednesday, November 03, 2010 9:05 AM
    Friday, October 29, 2010 9:52 AM
  • [PS] C:\Windows\system32>search-mailbox -identity "Orlov Kirill" -targetfolder "TESTTEST" -targetmailbox "Discovery Search Mailbox" -DeleteContent  -searchquery "SpRecord"

    Не удается найти позиционный параметр, принимающий аргумент "-DeleteContent".
        + CategoryInfo          : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox

    Why it so?

    Maybe in cmdlet agument order?

    without -DeleteContent  search-mailbox work fine with same parameters

     

    Friday, October 29, 2010 11:31 AM
  • Hi Postman2010,

    As I said, if you want to run Search-Mailbox with parameter -DeleteContent, you must be assigned the "Mailbox import Export" Role.

    To confirm, please run the cmdlet Get-ManagementRoleAssigment -RoleAssignee "search admin" to check whether the Role has been assigned or not.

    You can also add the Role to the "search admin" directly.

    Details:

    Add a Role to a User or USG

    Frank Wang
    Monday, November 01, 2010 2:07 AM
  • Hi Postman2010,

    Any updates on your issue?


    Frank Wang
    Wednesday, November 03, 2010 1:30 AM
  • Frank Thank You!! your answer was very usefull! everything works fine!
    Wednesday, November 03, 2010 9:06 AM
  • ... about DeleteContent without parameters.

    You forgot to mention the last step - rerun Exchange Management Shell to load commandlets again (after adding youself to the exchange groups). Thanks to everybody.

    Friday, September 23, 2016 8:54 AM