Hi,
I’m trying to automate the exporting process of a particular mailbox to PST, so I created this simple script:
$Firstdayofthismonth = Get-Date -day 1 -Hour 0 -Minute 0 -Second 0 $Firstdayoflastmonth = (Get-Date -day 1 -Hour 0 -Minute 0 -Second 0).AddMonths(-1) New-MailboxExportRequest -Mailbox "UserMailbox" -FilePath "Path to the PST" -ContentFilter {(Received -lt $Firstdayofthismonth) -and (Received -ge $Firstdayoflastmonth)}
the idea is, after the end of one month the script would run and export last-one-month worth of emails to PST, but when I ran the script for testing, it exported the entire mailbox rather than only last month, maybe the -contentfilter parameter doesn’t accept variables?
Can anyone help?
Thanks