Forum Discussion
Anonymous
Mar 27, 2018How to filter last 30 days on Get-MailboxSearch?
Hi
I have this script but I need to be able to report on the last 30 days only:
$When = (get-date).AddDays(-30).ToString("dd/MM/yyyy HH:mm:ss")
Get-MailboxSearch | Select Name, InPlaceHoldEnab...
- AnonymousMar 27, 2018
Got the solution - the date variable needs the same format as the property:
$When = (get-date).AddDays(-30).ToString("MM/dd/yyyy HH:mm:ss") $holdsReport = Get-MailboxSearch | Select Name, InPlaceHoldEnabled,@{n="ExportDate";e={[datetime]($_.LastEndTime)}}| Where-Object ExportDate -GT $when | Sort-Object ExportDate -DescendingM
adam_d
Mar 27, 2018Copper Contributor
In your Get-MailboxSearch, you should be able to use -SearchQuery "Sent: $when"
- AnonymousMar 27, 2018Hi
I am not searching for emails. all I want to to see is in-place hold accounts.
M- adam_dMar 27, 2018Copper ContributorMight be easier to filter on the AD attrib msExchLitigatiomHoldDate then