Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to search mailboxes (after doing an export to PST) and delete messages that meet a certain criteria.

Everytime I try and run the Search-Mailbox command, I get the following output:

The target mailbox or .pst file path is required.
    + CategoryInfo          : InvalidArgument: (:) [], ArgumentException
    + FullyQualifiedErrorId : 79CD2AE3

I've even tried the examples that PowerShell shows and still get the same message.

An example of trying a command out:

[PS] C:\Windows\system32>Search-Mailbox -Identity "David Tester" -SearchQuery "Subject:'Your bank statement'"
The target mailbox or .pst file path is required.
    + CategoryInfo          : InvalidArgument: (:) [], ArgumentException
    + FullyQualifiedErrorId : 79CD2AE3

[PS] C:\Windows\system32>

Any help would be great

Thanks

share|improve this question
    
Could you please display your entire search-mailbox line so I can be more help? –  Chris N Oct 26 '11 at 11:30
    
Sure. I'll add it now –  fdf33 Oct 26 '11 at 11:40

1 Answer 1

up vote 1 down vote accepted

The issue is that you need to have some target mailbox and folder, or else the DeleteContent flag.

Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -TargetMailbox "administrator" -TargetFolder "SearchAndDeleteLog" -LogOnly -LogLevel Full

The example above is a Log Only search that won't move any messages.

See the manual page for the Search-Mailbox command and note which switches are required.

http://technet.microsoft.com/en-us/library/dd298173.aspx

share|improve this answer
    
Thanks! Tried it and worked a charm –  fdf33 Oct 26 '11 at 16:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.