locked
schedule auto archive of journal mailbox with exchange powershell RRS feed

  • Question

  • Hi

    I want to setup a schedule on the 20th of each month to archive all email from my journal account called 'archive' to a network location.  Easy enough.  I want all email in the mailbox archived.  Again easy.  However, I wan to creat a powershell script to add the date to the name of the .pst.  This is the script i have created:

    ------------------------------------------------------------

    $date = ( get-date ).ToString('yyyyMMdd')                                                                                            
    $pst = New-Item -type file "$date-JOURNAL.PST"                                                                                    
    Export-Mailbox -Identity archive -PSTFolderPath \\fileserver1\c$\Archive\$pst

    -------------------------------------------------------------

    What I'm not sure about is the -type being 'file'.  Is there a type object called PST?

    Paul

    Thursday, March 3, 2011 12:23 PM

Answers

All replies

  • You don't need to use the new-item name since you can specify the name of the PST with export-mailbox

     

    $date = ( get-date ).ToString('yyyyMMdd')                                                                                             
    $pst = "$date-JOURNAL.PST"                                                                                     
    Export-Mailbox -Identity archive -PSTFolderPath \\fileserver1\c$\Archive\$pst

    if you do a help export-mailbox -examples you can see an example of where the specify a PST filename


    Exchange & Powershell Geek
    View my MCP Certifications
    • Proposed as answer by Aaron MCITP Friday, March 4, 2011 1:01 PM
    Thursday, March 3, 2011 2:37 PM
  • Thanks Aaron
    • Marked as answer by Ethiepeeps Friday, March 4, 2011 11:39 AM
    Friday, March 4, 2011 11:31 AM