I am having a problem getting "Search-Mailbox -SearchQuery" to accept a variable.
There are examples in the script on how to properly format the query (not shown here).
The problem appears to be the variable ($query) is not recognized by the
CMDLET search-mailbox. Do you have any suggestions?
$query=read-host "enter your query"
get-mailbox -resultsize unlimited |Search-Mailbox -SearchQuery '$query' -searchdumpster -targetmailbox "mailbox name" -targetfolder "folder name" -loglevel full
Dale