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

delete old items older then 30 days from user mail box (exchange 2013)

$
0
0

Hi,

I'm trying to run this command (exchange 2013), delete mails that are older then 30 days:

[int]$numberOfDays=30

[DateTime]$date=[DateTime]::Now.Subtract([TimeSpan]::FromDays($numberOfDays))

Get-Mailbox -Identity $m |Search-Mailbox -SearchQuery {(Received -ge $date) } -DeleteContent

 

$m is the mailbox  identity.

$date is the date ,that mails that older or equal to  $date I want to delete.

 

I get this error:

Search-Mailbox : Could not load file or assembly 'Microsoft.Ceres.NlpBase.RichTypes, Version=16.0.0.0, Culture=neutral, PublicKeyToken

=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

At line:1 char:27

+ Get-Mailbox -Identity $m |Search-Mailbox -SearchQuery {(Received -ge $date) } -D ...

+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Search-Mailbox], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Exchange.Management.Tasks.SearchMailbox

need help with this issue.
Thanks,
Lior

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles