Clear out old messages in Exchange 2010 journal mailbox after messages are archived to .PST Getting Error on Date

# THIS IS THE FIRST COMMAND THAT I RUN IN A SEPARATE .PS1 FILE. THIS SEEMS TO WORK FINE:
New-MailboxExportRequest JournalMailbox -FilePath '\\dfsdr.dc.pud\PowershellEmailArchive\Journal.pst'
# NEXT I AM TRYING TO CLEAN OUT EVERYTHING ELSE UP UNTIL 1-2 DAYS AGO BUT GETTING THIS ERROR:
[PS] C:\scripts>.\CleanOutOldMsg.ps1
Please adjust the date time. Make sure it is in the correct format.
    + CategoryInfo          : InvalidArgument: (:) [], ParserException
    + FullyQualifiedErrorId : 44F6D37F
# HERE'S WHAT I'VE DONE:
$global:startDate = (Get-Date).AddDays(-31).ToString('MM/dd/yyy')
$global:endDate = (get-date).AddDays(-1).ToString('MM/dd/yyy')
# HAVE TRIE THIS DATE FORMAT TOO:
$endDate = (Get-Date).AddDays(-1).ToShortDateString()
$startDate = (Get-Date).AddDays(-31).ToShortDateString()
# AND ALSO THIS DATE FORMAT:
# $endDate = Get-Date -Day 2 "00:00:00"
# $startDate = $endDate.AddDays(-30)
# $endDate = $endDate.ToShortDateString()
# $startDate = $startDate.ToShortDateString()
# THIS COMMAND GIVES DATE ERRORS:
Search-Mailbox -Identity JournalMailbox -TargetFolder inbox -TargetMailbox jimk -SearchQuery "Received:'${startDate}'..'${endDate}'" -DeleteContent -Force
# THIS COMMAND GIVES DATE ERRORS TOO:
Get-Mailbox -Identity "JournalMailbox" | Search-Mailbox -SearchQuery "Received:'${startDate}'..'${endDate}'" -DeleteContent -Force
# THIS WORKS:
Search-Mailbox -Identity JournalMailbox -TargetFolder inbox -TargetMailbox jimk -SearchQuery "Received:02/07/2014..03/07/2014" -DeleteContent -Force
# I FOUND SOME OF THE INFORMATION HERE:
https://serverfault.com/questions/511610/how-can-i-move-exchange-items-to-a-pst-using-powershell
Thanks in advance! Jim
Sorry if I wasn't as clear as I could have been.  I'm trying to clean out the Journal mailbox after exporting the messages to a .PST file.  I've tried formatting the date different ways and when I check it the format seems OK. For some reason I'm
still getting the same error.  I've tried this which was suggested and I received the same error listed above:
Search-Mailbox -Identity JournalMailbox -TargetFolder inbox -TargetMailbox jimk -SearchQuery "Received:'${$startDate}'..'${$endDate}'" -DeleteContent -Force
For some reason the -SearchQuery is not accepting the variable.
Thanks,  Jim

Thank You Yan Li!   I ran commands both ways and still received errors.  Here's the first command and the error message: 
Search-Mailbox -Identity JournalMailbox -TargetFolder inbox -TargetMailbox jimk -SearchQuery "Received:"$startDate".."$endDate"" -DeleteContent -Force
Error: 
[PS] C:\scripts>.\CleanOutOldMsg.ps1
A positional parameter cannot be found that accepts argument '02/10/2014..03/12/2014'.
    + CategoryInfo          : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox
Here's the result of the following command which is formatted a bit different per your suggestion:
Search-Mailbox -Identity JournalMailbox -TargetFolder inbox -TargetMailbox jimk -searchQuery "Received:>$startDate and Recieved:< $enddate" -DeleteContent -Force
[PS] C:\scripts>.\CleanOutOldMsg.ps1
The property keyword isn't supported.
    + CategoryInfo          : InvalidArgument: (:) [], ParserException
    + FullyQualifiedErrorId : 34A6B2A1
Would you happen to have any other suggestions?  Thanks in advance!  Jim

Similar Messages

  • Mavericks Mail; difference in delete folder and trash folder?  I don't know which folder to use clearing out old messages, spam, junk and other detrious I might want to recover in the future and which folder for highly sensitive or personal  informa

    I don't know which folder to use clearing out old messages, spam, junk and other detrious I might want to recover in the future and which folder for highly sensitive or personal  in formation I want to keep confidential.

    More to my question regarding standard Mail folders, how do Trash and Delete differ in function?

  • When I send e-mail messages with file by using a POP3 in Exchange 2010 I received delivered message with file. How I can disable this functions that file do not include to delivery message. I use Exchange 2010 only local users.

    When I send e-mail messages with file by using a POP3 in Exchange 2010 I received delivered message with file. How I can disable this functions that file do not include to delivery message.  I use Exchange 2010 only local users.

    I think there is not native rule for this, but you could try a transport rule which removes all attachments over a very small file size like 1KB.
    http://blogs.technet.com/b/exchange/archive/2009/05/11/3407435.aspx
    CRM Advisor

  • Is there any way so that I Being able to clear out old data from the Order

    Hi Friends,
    Is there any way so that I Being able to clear out old data from the Order Gate forecast, tolerance, and confirmed order to date tables on a monthly basis?
    Means I want data in data table for particular time (I want that if suppose today is 13-11-2008 then my data table must contain data from 13-10-2008 to 13-11-2008.
    Is it possible thru ABAP development or thru any t codes ?
    Any pointers will be rewarded.
    Regards

    hi,
    Before archiving you have to put the Deletion flag for the object(May be for PO, MMR etc as per your req.)...
    After that the you use the archiving procedure to archive the docs which are already flagged for deletion...
    For MMR you use the transaction SARA...and its respective object for the archiving....
    You can use the SDN search to see the many threads on it...
    Or use this link as per your req. and make the search...
    http://help.sap.com/saphelp_erp2004/helpdata/EN/75/ee0fa855c811d189900000e8322d00/frameset.htm
    Regards
    Priyanka.P

  • How do I clear out old contacts from showing up on new contact searches

    How do I clear out old contacts from showing up on new contact searches

    Go to Settings > Mail, Contacts, Calendars > Show In App Switcher
    From there you can turn off Phone Favorites and/or Recents

  • Clearing out old process data

    How can I clear out old process data? In my test environment, I have several hung tasks that will not terminate. The tasks exist, but the process they were associated with no longer do.

    There was a bug in 8.0 that I believe is fixed in 8.2 where tasks assigned to a group were not removed when the process was terminated.
    Your easiest solution right now is:
    - create a dummy local user called "dummy" or something like that
    - go into adminui/process management/task management, find the tasks, and allocate them to the dummy user.
    They will still be there, but at least they won't irritate anyone.
    Howard
    http://www.avoka.com

  • I have an imac 27" 6 months old. When i turn it on after 20-25 mnts the screen gets vapourized. After an hour it gets cleared. How serious is it ?

    I have an imac 27" 6 months old. When i turn it on after 20-25 mnts the screen gets vapourized. After an hour it gets cleared. How serious is it ? 

    Contact Apple Service, iMac Service or Apple's Express Lane and get it repaired/replaced. I had the display on my 27" iMac go south three months after buying it and they replaced it due to a similar fault. Do note that if you have AppleCare's protection plan and you're within 50 miles (80 KM) of an Apple repair station, you're eligible for onsite repair since yours is a desktop machine.

  • Weird issue with Exchange 2010 Room Mailboxes - allows multiple booking of the created meeting rooms

    Hi,
    we are facing weird issue with Exchange 2010 Room Mailboxes
    it allows multiple booking of the created meeting rooms.Sometime we are not getting acceptance or declined mail but and we could see our meetings has been booked at slot.
    for e.g.
    User A booked room1 with weekly recurrence for time 4pm to 5pm., and User B made his  booking other day,without realizing that user A meeting is exists.
    Neither of user A nor user B got declined/rejected emails.
    please sahre guidelines if anyone known to this issue.
    Note - Allow Conflict booking is disabled already :) but still have issue
    Thanks,
    NPratik

    Hi,
    Just add more in this issue, following testing is done.
    referring results and conclusion, you will get better view on issue 
    ====================
    Test Case - 1
    User OnCloud/O365 - Pratik Nimbalkar
    Email ID - [email protected]
    ( same as UPN)
    Room Booking Scenario - Book Room for 6.30pm to 7.30pm slot
    Results - Accepted
    Room Booking Scenario for same slot- ReBook Room for 6.30pm to 7.30pm slot
    Results - Declined
    Conclusion = working fine
    ==================
    Test Case - 2
    User OnCloud/O365 - Testsm
    Email ID - [email protected]
    ( different from UPN)
    Room Booking Scenario - Rebook Room for 6.30pm to 7.30pm slot
    Results - No Response from Room Mailbox neither Accepted nor Declined
    But we can see as booked as "Tentative"
    Room Booking Scenario for same slot- Rebook Room for 6.30pm to 7.30pm slot
    Results -No Response from Room Mailbox neither Accepted nor Declined
    But we can see as booked as "Tentative"
    =========================
    Conclusion = There is issue with booking room and not getting response while user is
    @abc.my id.
    ======================
    Note = for all other on premise users those are having @abc.co.in
    and @abc.my it is working fine. Users are getting respective correct reply from room mailboxes.
    This issue seems with only on cloud
    @abc.my users

  • HT201413 cannot reinstall itunes, i get this message MSVCR80.dll not found.  Try to reinstall itunes and i get error 7 (Windows erro 126)  help please

    cannot reinstall itunes, i get this message MSVCR80.dll not found.  Try to reinstall itunes and i get error 7 (Windows erro 126)  help please

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • How do I get a licence for Photo shop which ran out (they didn't tell me that when I bought the MacBook Pro - I get error 150/30

    how do I get a licence for Photo shop which ran out (they didn't tell me that when I bought the MacBook Pro - I get error 150/30?

    Download Adobe's License Repair Tool: Error "Licensing has stopped working" | Mac OS
    Additional information you may find useful: http://blog.erikphansen.com/adobe-cs4-error-15030-aka-i-hate-adobe-reason-34/

  • Unable to clear flags in Mail using Exchange 2010

    I am able to flag messages without a problem, but when I try to turn those flags off within a few moments it will sync them back to "flagged."  I basically cannot unflag a flagged message.  Connected to an Exchange 2010 server.  Not having any problems getting or syncing mail.  Activity window is clear and nothing is queued up.
    I see "changing flags" pop up really quick in the Activity window but as soon as it sync's back up with Exchange those flags come right back.
    Help!

    I've found a solution that works for me, although it's a little technical.
    I found that the Envelope Index file in Home/Library/Mail/V2/MailData/ is actually a sqlite3 database.
    the steps I followed were:
    Quit Mail (don't know if this is necessary)
    Open Terminal, and cd to ~/Library/Mail/V2/MailData/
    open the sqlite db using the sqlite3 command line client:
    $> sqlite3 Envelope\ Index
    Now, in the sqlite3 command shell I queried the messages table to see which messages were flagged:
    sqlite> select * from messages where flagged = '1';
    I verified that the one message I couldn't clear was in the result set and then I updated the database and cleared the flag:
    sqlite> update messages set flagged = '0' where flagged = '1';
    Re-start Mail, and voila - flagged messages gone.
    Note: to selectively clear the flags from only certain messages would probably require a more advanced update statement that included some join in the where clause.

  • Configuring Message Clasifications Exchange 2010 - Outlook 2007/2010/2013

    Hi
    I created Message Classification as described in:
    http://technet.microsoft.com/en-us/library/bb123498(v=exchg.141).aspx
    New-MessageClassification ....
    New MessageClassification is visible in OWA.
    I stared deploy Message Classifications for Outlook 2007 using this
    http://technet.microsoft.com/en-us/library/aa998271(v=exchg.141).aspx
    Of course there is small bug: "AdminClassificationPath"="c:\\Classifications.xml" but is should be
    "AdminClassificationPath"="c:\Classifications.xml"
    After set up it doesn't work. The same for Outlook 2010 and 2013?
    Does anybody deploy Message Classifications for Outlook 2007 or 2010 or 2013 with success?
    I use Exchange 2010 SP3 with all RU and Outlook 2007, 2010, 2013 with all updates.
    Kind Regards Tomasz

    Hi,
    How do you know this is an old reoccurring message? Based on the content or time?
    Since the MailboxAutoReplyConfiguration is correct, I suspect the issue can occur by certain client machine. At this stage, I suggest you disable OOF and re-enable
    OOF on the problematic machine. If the issue persists, please refer to the following article to clean the problematic client’s Outlook rules. (run Outlook.exe /cleanrules in Run console.)
    http://www.tech-recipes.com/rx/2161/outlook_2007_clean_up_command_line_switches/
    Thanks.
    Novak Wu
    TechNet Subscriber Support in forum
    If you have any feedback on our support, please contact
    [email protected]  
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Apple Mail can't send or receive messages from Exchange 2010, Mountain Lion

    Over the last several weeks, I have been unable to send or recieve e-mails from Exchange 2010 in a corprate environment.  I have deleted and re-added the account several times, and sometimes it will fix the issue.  Other times it won't.  I have also tried deleting the account, clearing the cache in ~/Library/Mail/V2/EWS*, and then re-adding the account.  It resolves the issue temporarily, but then returns to not being able to sync.  I've tested it with a number of other users accounts on the same Exchange system, and it's working as expected.  OSX is version 10.8.4 with current patches as of 10/7/2013.
    The connection doctor shows that the connection to EWS is green.  The activity monitor looks like it's updating the folders properly on sync.
    Here is the message I get in the logs in high volume when Console logging is turned on:
    *** Assertion failure in -[EWSConnection sendMessage:forRequest:], /SourceCache/Message/Message-1508/Message/EWS/EWSConnection.m:555
    Received an unexpected error: Error Domain=EWSExchangeWebServicesErrorDomain Code=277 "The operation couldn’t be completed. (EWSExchangeWebServicesErrorDomain error 277.)" UserInfo=0x7fd1c9a97e70 {EWSErrorMessage=The request failed schema validation., NSUnderlyingError=0x7fd1c85106f0 "The operation couldn’t be completed. (SOAPWebServicesErrorDomain error -1000.)"}, response: (null)
              0   CoreMessage                         0x00007fff86a4a517 -[MFAssertionHandler _handleFailureWithPreamble:description:arguments:] + 141
              1   CoreMessage                         0x00007fff86a4a388 -[MFAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 215
              2   Message                             0x00007fff8daa5a8e -[EWSConnection sendMessage:forRequest:] + 762
              3   Message                             0x00007fff8daaeab3 -[EWSGateway sendMessage:forRequest:] + 69
              4   Message                             0x00007fff8dac543a -[EWSRequestOperation executeOperation] + 110
              5   CoreMessage                         0x00007fff86a65b80 -[MonitoredOperation main] + 219
              6   Foundation                          0x00007fff92475926 -[__NSOperationInternal start] + 684
              7   Foundation                          0x00007fff9247d0f1 __block_global_6 + 129
              8   libdispatch.dylib                   0x00007fff87f4af01 _dispatch_call_block_and_release + 15
              9   libdispatch.dylib                   0x00007fff87f470b6 _dispatch_client_callout + 8
              10  libdispatch.dylib                   0x00007fff87f481fa _dispatch_worker_thread2 + 304
              11  libsystem_c.dylib                   0x00007fff9068ad0b _pthread_wqthread + 404
              12  libsystem_c.dylib                   0x00007fff906751d1 start_wqthread + 13

    Over the last several weeks, I have been unable to send or recieve e-mails from Exchange 2010 in a corprate environment.  I have deleted and re-added the account several times, and sometimes it will fix the issue.  Other times it won't.  I have also tried deleting the account, clearing the cache in ~/Library/Mail/V2/EWS*, and then re-adding the account.  It resolves the issue temporarily, but then returns to not being able to sync.  I've tested it with a number of other users accounts on the same Exchange system, and it's working as expected.  OSX is version 10.8.4 with current patches as of 10/7/2013.
    The connection doctor shows that the connection to EWS is green.  The activity monitor looks like it's updating the folders properly on sync.
    Here is the message I get in the logs in high volume when Console logging is turned on:
    *** Assertion failure in -[EWSConnection sendMessage:forRequest:], /SourceCache/Message/Message-1508/Message/EWS/EWSConnection.m:555
    Received an unexpected error: Error Domain=EWSExchangeWebServicesErrorDomain Code=277 "The operation couldn’t be completed. (EWSExchangeWebServicesErrorDomain error 277.)" UserInfo=0x7fd1c9a97e70 {EWSErrorMessage=The request failed schema validation., NSUnderlyingError=0x7fd1c85106f0 "The operation couldn’t be completed. (SOAPWebServicesErrorDomain error -1000.)"}, response: (null)
              0   CoreMessage                         0x00007fff86a4a517 -[MFAssertionHandler _handleFailureWithPreamble:description:arguments:] + 141
              1   CoreMessage                         0x00007fff86a4a388 -[MFAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 215
              2   Message                             0x00007fff8daa5a8e -[EWSConnection sendMessage:forRequest:] + 762
              3   Message                             0x00007fff8daaeab3 -[EWSGateway sendMessage:forRequest:] + 69
              4   Message                             0x00007fff8dac543a -[EWSRequestOperation executeOperation] + 110
              5   CoreMessage                         0x00007fff86a65b80 -[MonitoredOperation main] + 219
              6   Foundation                          0x00007fff92475926 -[__NSOperationInternal start] + 684
              7   Foundation                          0x00007fff9247d0f1 __block_global_6 + 129
              8   libdispatch.dylib                   0x00007fff87f4af01 _dispatch_call_block_and_release + 15
              9   libdispatch.dylib                   0x00007fff87f470b6 _dispatch_client_callout + 8
              10  libdispatch.dylib                   0x00007fff87f481fa _dispatch_worker_thread2 + 304
              11  libsystem_c.dylib                   0x00007fff9068ad0b _pthread_wqthread + 404
              12  libsystem_c.dylib                   0x00007fff906751d1 start_wqthread + 13

  • Different Exchange 2010 journaling

    We transition from Exchange 2003 to Exchange 2010 SP1.  Now I enabled the journaling on each DB and I checked the journal mailbox and the journaling message is as
    Microsoft Outlook on behalf of Smith, Ana Sent:  Wed 3/30/2011 2:15 PM
    To:   John, Smith
    Cc:   
    Subject:   test6
    Attachments:   test6‎(2KB)‎ 
    Sender: [email protected]
    Subject: test6
    Message-Id: <[email protected]>
    To: [email protected]
    The captured message is in the attachment.  How can we use the above the journaling message for compliance?
    Can we get the journaling to capture the real message like Exchange 2003 sender: From Smith, Ana; to Smith, John
    Subject: test6
    and messgae in the body, not in the attachment?  What might I miss?
    Thank you!

    It was changed to comply with the various laws and at the request of those who need to work with them. It means the message is a true copy of what went through the server. A copy of the message just delivered to the mailbox is not a true copy, it will
    be modified because it may have additional header information applied as it is delivered to the journal mailbox.
    Most people will use a third party tool to manage the journal mailbox, rather than opening the messages directly.
    When you move it I don't think really matters.
    Simon.
    Simon Butler, Exchange MVP
    Blog |
    Exchange Resources | In the UK?
    Hire Me.
    Could you give an example of a third party tool that does extract these .msg files and sends them to a different mailbox?

  • Exchange 2010 user Non-deliverable message

    Any help is appreciated. We have a user who is trying to email a vendor who she normally can but now she is getting an NDR message stating:
    The following organization rejected your message: [XXX]. <- other company's IP
    Diagnostic information for administrators:
    Generating server:
    esa1.XXX.iphmx.com  <- our server
    Recipient's email address
    [XXX] <- other company's IP #<[XXX] <- other company's IP #5.0.0 smtp;
    5.3.0 - Other mail system problem 550-'permanent failure for one or more
    recipients (recipients email address:blocked)' (delivery attempts: 0)>
    #SMTP#
    Original message headers:
    X-IronPort-AV:
    E=Sophos;i="4.84,830,1355126400";
    d="xml'?bin'?scan'208,217,72,48?xlsx'208,217,72,48,72,48?rels'208,217,72,48,72,48";a="8561738"
    Received:
    from firewall01.XXX.com (HELO  <- our company's system
    webmail.XXX.com) <- our company's system
    ([IP]) by esa1.XXX.iphmx.com <- our company's system 
    with ESMTP; 12 Mar 2013
    04:30:48 -0800
    Received: from
    TMIEXMB02.XXX.com ([IP])  <- our company's system
    by
    TMIEXCAS02.XXX.com ([IP]) with mapi id  <- our company's system
    14.02.0247.003;

    Any help is appreciated. We have a user who is trying to email a vendor who she normally can but now she is getting an NDR message stating:
    The following organization rejected your message: [XXX]. <- other company's IP
    Diagnostic information for administrators:
    Generating server:
    esa1.XXX.iphmx.com  <- our server
    Recipient's email address
    [XXX] <- other company's IP #<[XXX] <- other company's IP #5.0.0 smtp;
    5.3.0 - Other mail system problem 550-'permanent failure for one or more
    recipients (recipients email address:blocked)' (delivery attempts: 0)>
    #SMTP#
    This NDR is stating that the recipient company has blocked this email address so you will have to contact them to see if they can lift the block or why it was blocked in the first place.
    Jason Apt, Microsoft Certified Master | Exchange 2010
    My Blog

Maybe you are looking for

  • MDM ResultSet iView

    Hi, In my page I have 2 iViews - an MDM ResultSet iView and  a web dynpro iView. In MDM ResultSet iView I have created a custom EPCF record event. The web dynpro application includes an iframe the source of which is another MDM ResultSet iview. The w

  • Loop in a Load Plan

    I'm sure this is doable, but I'm just too dense to see it... Load Plans are really cool -- I like the way it organizes steps (large Packages are cumbersome and while I have encapsulated with Scenarios it can get tricky for me) and I really like the w

  • Fade image in?

    Is it possible to fade an image in? The image itself is inserted into a table cell with an Image Map over it. I need the image to fade in so that the map that contains a link will work. Thanks

  • Error parsing XML license file

    i need assistance while installing WebLogic 5.1 Evaluation version on my NT Server and i also registered and downloaded the key for that but still my server is not functioning as it gives me a license file error in java..... The error is as follows..

  • No provider for Address type : rfc822

    In my workflow, after instantiating the EJBs, I send a request mail to the Manager through the WLPI workflow. Everything was going fine. But, ever since we have moved our SMTP server to a new location, (maintaining the same host name ), I have been g