none
New-MailboxExportRequest, ContentFilter problem, Error code: -2146233088 RRS feed

  • Question

  • Hello,

    Maybe some one could help me, i have powershell script that export mails to PST every 10 days, it runs through Task Scheduler

    After migration from Exchange 2010 to Exchange 2019 the script not working, when i start to checking to figure out why its not works,in the logs i found that the problem with one of the filters (ContentFilter),

    getting next error:

    S C:\WINDOWS\system32> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | fl *failure*
    
    
    TotalTransientFailureDuration : 00:00:00
    FailureCode                   : -2146233088
    FailureType                   : InvalidContentFilterPermanentException
    FailureSide                   : 
    FailureTimestamp              : 24/06/2019 10:01:46
    LastFailure                   : <MiniFailureRec Time="2019-06-24T07:01:46.5537768Z" Type="InvalidContentFilterPermanentExceptio
                                    n" Side="0" Fatal="true" ETypes="1 10 12" ExStackHash="1a9f" />

    And this is the full log

    PS C:\WINDOWS\system32> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | fl
    
    
    RunspaceId                               : fa670658-8679-42f4-83a0-14f5467fb364
    Name                                     : Mailjournal 23_06_2019-13_06_2019.pst
    Status                                   : Failed
    StatusDetail                             : FailedOther
    SyncStage                                : None
    Flags                                    : IntraOrg, Push, Suspend
    RequestStyle                             : IntraOrg
    Direction                                : Push
    Protect                                  : False
    Priority                                 : Normal
    WorkloadType                             : Local
    Suspend                                  : True
    FilePath                                 : \\192.168.1.234\MailjournalNew\Mailjournal 23_06_2019-13_06_2019.pst
    ComplianceStorePath                      : 
    PreferredMessageFormat                   : Default
    SourceAlias                              : MailJournal
    SourceIsArchive                          : False
    SourceExchangeGuid                       : 4034d0e2-8867-49a7-84f6-10a504718726
    SourceRootFolder                         : 
    RecipientTypeDetails                     : UserMailbox
    SourceVersion                            : Version 15.2 (Build 330.0)
    SourceMailboxIdentity                    : Ofrandm.local/MYCOMPANY/Users/All Departments/MailJournal
    SourceDatabase                           : MY-EX-DB01
    SourceServer                             : MY-EX.MyCompany.local
    TargetRootFolder                         : 
    IncludeFolders                           : {inbox}
    ExcludeFolders                           : {}
    ExcludeDumpster                          : False
    ConflictResolutionOption                 : KeepSourceItem
    AssociatedMessagesCopyOption             : Copy
    BatchName                                : 
    StartAfter                               : 
    CompleteAfter                            : 
    ContentFilter                            : ((Received -ge '13/06/2019 00:00:00') -and (Received -lt '23/06/2019 00:00:00'))
    ContentFilterLanguage                    : 
    BadItemLimit                             : 0
    BadItemsEncountered                      : 0
    LargeItemLimit                           : 0
    LargeItemsEncountered                    : 0
    QueuedTimestamp                          : 23/06/2019 16:31:00
    StartTimestamp                           : 
    LastUpdateTimestamp                      : 24/06/2019 10:01:46
    LastSuccessfulSyncTimestamp              : 
    InitialSeedingCompletedTimestamp         : 
    CompletionTimestamp                      : 
    SuspendedTimestamp                       : 
    OverallDuration                          : 00:00:27.1336092
    TotalSuspendedDuration                   : 00:00:00
    TotalFailedDuration                      : 17:46:30.0525006
    TotalQueuedDuration                      : 00:00:04.5679117
    TotalInProgressDuration                  : 00:00:22.5656975
    TotalStalledDueToContentIndexingDuration : 00:00:00
    TotalStalledDueToMdbReplicationDuration  : 00:00:00
    TotalStalledDueToMailboxLockedDuration   : 00:00:00
    TotalStalledDueToReadThrottle            : 00:00:00
    TotalStalledDueToWriteThrottle           : 00:00:00
    TotalStalledDueToReadCpu                 : 00:00:00
    TotalStalledDueToWriteCpu                : 00:00:00
    TotalStalledDueToReadUnknown             : 00:00:00
    TotalStalledDueToWriteUnknown            : 00:00:00
    TotalTransientFailureDuration            : 00:00:00
    TotalIdleDuration                        : 13.03:05:24.2025260
    MRSServerName                            : MY-EX.MyCompany.local
    EstimatedTransferSize                    : 0 B (0 bytes)
    EstimatedTransferItemCount               : 0
    BytesTransferred                         : 0 B (0 bytes)
    BytesTransferredPerMinute                : 0 B (0 bytes)
    ItemsTransferred                         : 0
    PercentComplete                          : 0
    CompletedRequestAgeLimit                 : 3650.00:00:00
    PositionInQueue                          : 
    InternalFlags                            : SkipKnownCorruptions,JobFeaturesComputed
    FailureCode                              : -2146233088
    FailureType                              : InvalidContentFilterPermanentException
    FailureSide                              : 
    Message                                  : The attempt to deserialize failed for type: 'System.UnitySerializationHolder'.
    FailureTimestamp                         : 24/06/2019 10:01:46
    IsValid                                  : True
    ValidationMessage                        : 
    OrganizationId                           : 
    RequestGuid                              : ecbf31e7-655a-47c7-a6ac-166b1e3718eb
    RequestQueue                             : MY-EX-DB01
    Identity                                 : ecbf31e7-655a-47c7-a6ac-166b1e3718eb
    DiagnosticInfo                           : 
    Report                                   : 
    LastFailure                              : <MiniFailureRec Time="2019-06-24T07:01:46.5537768Z" Type="InvalidContentFilterPermanentExc
                                               eption" Side="0" Fatal="true" ETypes="1 10 12" ExStackHash="1a9f" />
    RequestExpiryTimestamp                   : 31/05/2119 07:01:46
    IsSyncAggregation                        : False
    IsShadowSync                             : False
    ObjectState                              : New

     

    My script to export email to pst:

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://MY-EX.MyCompany.local/PowerShell/ -Authentication Kerberos
    Import-PSSession $Session
    
    $SourceMailbox = "mailjournal"
    $endDate = Get-Date "00:00:00"
    $startDate = $endDate.AddDays(-10)
    $enddatestring = $enddate.ToString('MM/dd/yyyy')
    $startdatestring = $startdate.ToString('MM/dd/yyyy')
    $dateTime = Get-Date -format "ddMMyyyy_hhmmsstt"
    $archiveDate = (Get-Date).ToString('dd_MM_yyyy')
    $archiveJobName = $SourceMailbox + " " + $archiveDate + $dateTime
    $ExportContentFilter = "(Received -ge '$startdatestring') -and (Received -lt '$enddatestring')"
    $enddatename = ($endDate).ToString('dd_MM_yyyy')
    $startdatename = ($startDate).ToString('dd_MM_yyyy')
    $archiveFile = "Mailjournal " + $enddatename + "-" + $startdatename + ".pst"
    $archiveFileDir = "\\192.168.1.234\MailjournalNew\"
    $archiveFilePath = $archiveFileDir + $archivefile
    $BatchName = "MailJournal " + $archiveDate + $endDate
    $searchStartDate = $startDate.ToString('dd/MM/yyyy')
    $searchEndDate = $endDate.ToString('dd/MM/yyyy')
    $searchDateRange = "Received:" + $searchStartDate + ".." + $searchEndDate
    ## Enter Mailbox name to witch LOGS will be exported
    $saveSearchLogMailbox = "IT"
    ## Enter the name of Mailbox Sub Folder where the logs will be exported
    $saveSearchLogFolder = "MailJournal-Backup"
    ## Start to export LOGS to targetMailbox = 'IT Mailbox' and TargetFolder = 'MailJournal-Backup'. 
    Get-Mailbox -Identity $SourceMailbox | Search-Mailbox -SearchQuery $searchDateRange -LogOnly -LogLevel Full -TargetFolder $saveSearchLogFolder -TargetMailbox $saveSearchLogMailbox
    ## Start the export job ##
    New-MailboxExportRequest -Mailbox $SourceMailbox -Name $archiveFile -ContentFilter $ExportContentFilter -FilePath "$archiveFilePath" -IncludeFolders "inbox"
    # Wait for the archiving job to complete
    $ExportStats = Get-MailboxExportRequest -Mailbox $SourceMailbox | Get-MailboxExportRequestStatistics 
    WHILE ($ExportStats.Status -eq "Queued") { Start-Sleep 30
    $ExportStats = Get-MailboxExportRequest -Mailbox $SourceMailbox | Get-MailboxExportRequestStatistics }
    WHILE ($ExportStats.Status -eq "InProgress") { Start-Sleep 30 
    $ExportStats = Get-MailboxExportRequest -Mailbox $SourceMailbox | Get-MailboxExportRequestStatistics }
    
    ## When the job is finnish and the status -eq to "Completed" then start remove all completed batch jobs
    
    IF ($ExportStats.Status -eq "Completed") 
    {
    Get-MailboxExportRequest -Status Completed -Name "$archiveFile" | Remove-MailboxExportRequest -Confirm:$false
    
    ## Start to search for all emails within '$searchDateRange' range and forcly DELETE all of them.
    
    Get-Mailbox -Identity $SourceMailbox | Search-Mailbox -SearchQuery $searchDateRange -DeleteContent -force
    #Disable-Mailbox -identity "AD\$ObjectName"
    }


    Zvi Alikyan


    Monday, June 24, 2019 7:31 AM

Answers

  • Hi Zvi,

    We did more research and found that this issue may be related to the system language or the date format. Please try with system language English (United States).

    Here is a similar issue, for your reference: using New-MailboxExportRequest in Exchange 2010 SP1

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, July 1, 2019 9:13 AM
    Moderator
  • Hi,

    Is there any update on this thread?

    If you have solved your problem, could you share with us? Maybe it will help more people with similar problems. If you have any questions or need further help on this issue, please feel free to post back.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Tzvi Alikian Sunday, July 7, 2019 11:47 AM
    Friday, July 5, 2019 9:48 AM
    Moderator

All replies

  • Hi Zvi,

    We create a mailbox export request with the similar ContentFilter. Is it the contentfilter you use in your script?

    New-MailboxExportRequest -Mailbox user02 -FilePath "\\EXCH2019\Users\administrator.CONTOSO\Desktop\share\test.pst" -ContentFilter "(Received -ge '05/03/2019') -and (Received -lt '05/24/2019')"

    Here is the result:

    It shows this contentfilter parameter is correct and the mailbox export request ran successfully.

    You can check the request statistics with IncludeReport parameter, more details will be listed:

    Get-MailboxExportRequest | Get-MailboxExportRequestStatistics -IncludeReport|fl

    You also can check Event Viewer for further analysis, some related error information may be included in the event log.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, June 25, 2019 4:47 AM
    Moderator
  • Hi lidya,

    Thank you for your replay,

    In my script i compile from this Strings to New-MailboxExportRequest Cmdlet

    $SourceMailbox = "mailjournal" $endDate = Get-Date "00:00:00" $startDate = $endDate.AddDays(-10) $enddatestring = $enddate.ToString('MM/dd/yyyy') $startdatestring = $startdate.ToString('MM/dd/yyyy') $dateTime = Get-Date -format "ddMMyyyy_hhmmsstt" $archiveDate = (Get-Date).ToString('dd_MM_yyyy') $archiveJobName = $SourceMailbox + " " + $archiveDate + $dateTime $ExportContentFilter = "(Received -ge '$startdatestring') -and (Received -lt '$enddatestring')" $enddatename = ($endDate).ToString('dd_MM_yyyy') $startdatename = ($startDate).ToString('dd_MM_yyyy') $archiveFile = "Mailjournal " + $enddatename + "-" + $startdatename + ".pst" $archiveFileDir = "\\192.168.1.234\MailjournalNew\" $archiveFilePath = $archiveFileDir + $archivefile $BatchName = "MailJournal " + $archiveDate + $endDate $searchStartDate = $startDate.ToString('dd/MM/yyyy') $searchEndDate = $endDate.ToString('dd/MM/yyyy') $searchDateRange = "Received:" + $searchStartDate + ".." + $searchEndDate

    ## Enter Mailbox name to witch LOGS will be exported

    $saveSearchLogMailbox = "IT"

    ## Enter the name of Mailbox Sub Folder where the logs will be exported

    $saveSearchLogFolder = "MailJournal-Backup"

    ## Start to export LOGS to targetMailbox = 'IT Mailbox' and TargetFolder = 'MailJournal-Backup'.

    Get-Mailbox -Identity $SourceMailbox | Search-Mailbox -SearchQuery $searchDateRange -LogOnly -LogLevel Full -TargetFolder $saveSearchLogFolder -TargetMailbox $saveSearchLogMailbox

    ## Start the export job ##

    New-MailboxExportRequest -Mailbox $SourceMailbox -Name $archiveFile -ContentFilter $ExportContentFilter -FilePath "$archiveFilePath" -IncludeFolders "inbox"



    Zvi Alikyan

    Tuesday, June 25, 2019 8:55 AM
  • Hi Zvi,

    I don't understand what you mean. We test the script you provided above without Search-Mailbox command, the mailbox export request works well:

    If you still cannot export mailbox to pst file successfully, you can check export request statistic with IncludeReport parameter for more details.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, June 27, 2019 2:34 AM
    Moderator
  • Thank for your replay,

    I"m getting same error when i run just single command without my script:

    Just for the record, I have exchange 2019 CU1 on-prem

    New-MailboxExportRequest -Mailbox "mailjournal" -Name "test1" -ContentFilter "(Received -ge '06/27/2019') -and (Received -lt '06/28/2019')" -FilePath "\\192.168.1.234\MailJournalNew\test1.pst" -IncludeFolders "inbox"
    
    

    And this is the report

    RunspaceId                               : 6bce09c2-4245-4cb8-82a0-4b1110a3cc73
    Name                                     : test1
    Status                                   : Failed
    StatusDetail                             : FailedOther
    SyncStage                                : None
    Flags                                    : IntraOrg, Push, Suspend
    RequestStyle                             : IntraOrg
    Direction                                : Push
    Protect                                  : False
    Priority                                 : Normal
    WorkloadType                             : Local
    Suspend                                  : True
    FilePath                                 : \\192.168.1.234\MailJournalNew\test1.pst
    ComplianceStorePath                      : 
    PreferredMessageFormat                   : Default
    SourceAlias                              : MailJournal
    SourceIsArchive                          : False
    SourceExchangeGuid                       : 4034d0e2-8867-49a7-84f6-10a504718726
    SourceRootFolder                         : 
    RecipientTypeDetails                     : UserMailbox
    SourceVersion                            : Version 15.2 (Build 330.0)
    SourceMailboxIdentity                    : EXCHANGE.COM/COMPANY/Users/All Departments/MailJournal
    SourceDatabase                           : EXCHANGE-DB01
    SourceServer                             : EXCHANGE.COM
    TargetRootFolder                         : 
    IncludeFolders                           : {inbox}
    ExcludeFolders                           : {}
    ExcludeDumpster                          : False
    ConflictResolutionOption                 : KeepSourceItem
    AssociatedMessagesCopyOption             : Copy
    BatchName                                : 
    StartAfter                               : 
    CompleteAfter                            : 
    ContentFilter                            : ((Received -ge '27/06/2019 00:00:00') -and (Received -lt '28/06/2019 00:00:00'))
    ContentFilterLanguage                    : 
    BadItemLimit                             : 0
    BadItemsEncountered                      : 0
    LargeItemLimit                           : 0
    LargeItemsEncountered                    : 0
    QueuedTimestamp                          : 27/06/2019 14:31:21
    StartTimestamp                           : 
    LastUpdateTimestamp                      : 27/06/2019 14:31:24
    LastSuccessfulSyncTimestamp              : 
    InitialSeedingCompletedTimestamp         : 
    CompletionTimestamp                      : 
    SuspendedTimestamp                       : 
    OverallDuration                          : 00:00:03.1965963
    TotalSuspendedDuration                   : 00:00:00
    TotalFailedDuration                      : 00:04:25.6197825
    TotalQueuedDuration                      : 00:00:03.0325880
    TotalInProgressDuration                  : 00:00:00.1640083
    TotalStalledDueToContentIndexingDuration : 00:00:00
    TotalStalledDueToMdbReplicationDuration  : 00:00:00
    TotalStalledDueToMailboxLockedDuration   : 00:00:00
    TotalStalledDueToReadThrottle            : 00:00:00
    TotalStalledDueToWriteThrottle           : 00:00:00
    TotalStalledDueToReadCpu                 : 00:00:00
    TotalStalledDueToWriteCpu                : 00:00:00
    TotalStalledDueToReadUnknown             : 00:00:00
    TotalStalledDueToWriteUnknown            : 00:00:00
    TotalTransientFailureDuration            : 00:00:00
    TotalIdleDuration                        : 00:00:00.1059994
    MRSServerName                            : EXCHANGE.COM
    EstimatedTransferSize                    : 0 B (0 bytes)
    EstimatedTransferItemCount               : 0
    BytesTransferred                         : 0 B (0 bytes)
    BytesTransferredPerMinute                : 0 B (0 bytes)
    ItemsTransferred                         : 0
    PercentComplete                          : 0
    CompletedRequestAgeLimit                 : 3650.00:00:00
    PositionInQueue                          : 
    InternalFlags                            : SkipKnownCorruptions,JobFeaturesComputed
    FailureCode                              : -2146233088
    FailureType                              : InvalidContentFilterPermanentException
    FailureSide                              : 
    Message                                  : The attempt to deserialize failed for type: 'System.UnitySerializationHolder'.
    FailureTimestamp                         : 27/06/2019 14:31:24
    IsValid                                  : True
    ValidationMessage                        : 
    OrganizationId                           : 
    RequestGuid                              : d609f318-1701-4357-9ebf-0e6e49aefc4c
    RequestQueue                             : EXCHANGE-DB01
    Identity                                 : d609f318-1701-4357-9ebf-0e6e49aefc4c
    DiagnosticInfo                           : 
    Report                                   : 27/06/2019 14:31:20 [EXCHANGE] 'EXCHANGE.COM/Users/Administrator' created request.
                                               27/06/2019 14:31:24 [EXCHANGE] The Microsoft Exchange Mailbox Replication service 'EXCHANGE.COM' (15.2.330.5 caps:3FFFFF) is examining the request.
                                               27/06/2019 14:31:24 [EXCHANGE] Sync state for request d609f318-1701-4357-9ebf-0e6e49aefc4c is null.
                                               27/06/2019 14:31:24 [EXCHANGE] Connected to source mailbox '4034d0e2-8867-49a7-84f6-10a504718726 (Primary)', database 'EXCHANGE-DB01', Mailbox server 'EXCHANGE.COM' Version 15.2 (Build 330.0).
                                               27/06/2019 14:31:24 [EXCHANGE] Fatal error InvalidContentFilterPermanentException has occurred.
                                               
    LastFailure                              : <MiniFailureRec Time="2019-06-27T11:31:24.4357465Z" Type="InvalidContentFilterPermanentException" Side="0" Fatal="true" ETypes="1 10 12" ExStackHash="1a9f" />
    RequestExpiryTimestamp                   : 03/06/2119 11:31:24
    IsSyncAggregation                        : False
    IsShadowSync                             : False
    ObjectState                              : New


    Zvi Alikyan

    Thursday, June 27, 2019 11:40 AM
  • I think this is a bug,

    And i think i found the solution take a look at the Release of exchange 2019 CU2, the release available from 18 June 2019.

    Look at first Issue that this cumulative update fixes.

    I will install this update tonight and will check if the problem is persist.

    https://support.microsoft.com/en-us/help/4488401/cumulative-update-2-for-exchange-server-2019
    Thursday, June 27, 2019 11:55 AM
  • After setup CU2

    Still continue getting error.

    Fatal error InvalidContentFilterPermanentException has occurred.

    FailureType                              : InvalidContentFilterPermanentException
    FailureSide                              : 
    Message                                  : The attempt to deserialize failed for type: 'System.UnitySerializationHolder'.

    ContentFilter                            : ((Received -ge '30/06/2019 00:00:00') -and (Received -lt '29/06/2019 00:00:00'))

    I tried to run single Cmdlet 

    New-MailboxExportRequest -Mailbox mailjournal -Name Test -ContentFilter {(Received -ge '06/30/2019') -and (Received -lt '06/29/2019')} -FilePath "\\192.168.1.234\PST\Mailjournal.pst" -IncludeFolders "inbox"


    Zvi Alikyan

    Sunday, June 30, 2019 7:20 AM
  • I think this is a bug,

    And i think i found the solution take a look at the Release of exchange 2019 CU2, the release available from 18 June 2019.

    Look at first Issue that this cumulative update fixes.

    I will install this update tonight and will check if the problem is persist.

    https://support.microsoft.com/en-us/help/4488401/cumulative-update-2-for-exchange-server-2019
    THE CU2 UPDATE NOT FIXED MY PROBLEM.

    Zvi Alikyan

    Sunday, June 30, 2019 7:39 AM
  • Hi Zvi,

    We did more research and found that this issue may be related to the system language or the date format. Please try with system language English (United States).

    Here is a similar issue, for your reference: using New-MailboxExportRequest in Exchange 2010 SP1

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, July 1, 2019 9:13 AM
    Moderator
  • Hi,

    Is there any update on this thread?

    If you have solved your problem, could you share with us? Maybe it will help more people with similar problems. If you have any questions or need further help on this issue, please feel free to post back.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Tzvi Alikian Sunday, July 7, 2019 11:47 AM
    Friday, July 5, 2019 9:48 AM
    Moderator
  • After Changing format in region from control panel to English (US).

    The -contentFilter work again

    Thank you lynda.


    Zvi Alikyan

    Sunday, July 7, 2019 11:47 AM