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
Best Answer
The issue is that you need to have some target mailbox and folder, or else the DeleteContent flag.
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