Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Date range -searchquery

$
0
0

Hi All

I have been trying to get this to work in a script with no joy. The command works if i remove " SearchQuery {(Received -lt '$end') -and (Received -gt'$start')}" What i am trying to do is to create a schedule task to do a search of a user mailbox dumpster every month

any help would be great

 

$start=(Get-Date).adddays(-30).addhours(-1)

$end=(Get-Date).adddays(-1).addhours(-1)

Search-Mailbox -Identity "user" -SearchDumpsteronly SearchQuery {(Received -lt '$end') -and (Received -gt '$start')}  -includeunsearchableitems -TargetMailbox searchresults -TargetFolder "searchresults" -Loglevel Full


Viewing all articles
Browse latest Browse all 6937

Trending Articles