Mar 27 2018 04:42 AM
Mar 27 2018 04:42 AM
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, InPlaceHoldEnabled,@{n="Export Date";e={[datetime]($_.LastEndTime)}}
I cannot find a way to be able to filter based on $when.
Any ideas please?
M
Mar 27 2018 04:53 AM
Mar 27 2018 05:30 AM
Mar 27 2018 05:56 AM
Mar 27 2018 07:15 AM
Mar 27 2018 07:15 AM
SolutionGot 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 -Descending
M
Mar 27 2018 07:15 AM
Mar 27 2018 07:15 AM
SolutionGot 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 -Descending
M