Monthly exports in mixed 2007/2010 environment via script RRS feed

  • Question

  • I have a mixed Exchange 2007 SP3 and Exchange 2010 environment with about 2500 users. Every month end I need to export a single OU of terminated users to PST files before I can delete the account. I am looking for a script that first reads a specific OU like TERMINATED\March2013, determines if it is a 2007/2010 user and then issues a New-MailboxExportRequest for all 2010 users. I will than review the export status and delete those users if completed successfully. After that I would like to export all 2007 users, verify the log output and delete the users as well. Today I do this manually for 30-75 people every month.

    For my manual process I use the following lines I edit the aliases every month by hand:


    New-MailboxExportRequest -Mailbox tom.jones -FilePath "\\FileServer\PST_May2013\tom.jones.pst"


    Add-mailboxpermission -Identity tom.smith -accessrights fullaccess -user EXADMIN

    Export-Mailbox -Identity tom.smith -PSTFolderPath M:\PST_May2013 -Confirm:$False

    Tuesday, September 3, 2013 5:36 AM

All replies

  • Do you have a question?

    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

    Tuesday, September 3, 2013 7:03 AM
  • Hello Michael

    Please try this script - written in simple terms.
    there are advanced script to do the purpose but just to keep it sweet & simple.

    for ex 2007

    get-mailbox -OrganizationalUnit "ou=Departed,ou=Staff,dc=COMPANY,dc=local" -resultsize unlimited -server exch2007 | Add-mailboxpermission -Identity tom.smith -accessrights fullaccess -user EXADMIN
    get-mailbox -OrganizationalUnit "ou=Departed,ou=Staff,dc=COMPANY,dc=local" -resultsize unlimited -server exch2007 | Export-Mailbox -Identity tom.smith -PSTFolderPath M:\PST_May2013 -Confirm:$False

     similarly change the server name to ex 2010 server for 2010 Server

    Syed MM - Messaging SME - IBM || MCTS: Microsoft Exchange Server 2007/2010 || MCSE || MCSA ||

    Tuesday, September 3, 2013 7:42 AM
  • The first portion where is says "tom.smith" likely needs to be a variable.  I will see if I can get somewhere with this, thank you for the pointer. 
    Tuesday, September 3, 2013 7:58 PM
  • Maybe i wasn't too clean but my request was help with a script, the rest I more or less outlined to show the foundatiuon like rights and so on are in place.

    Tuesday, September 3, 2013 7:59 PM
  • Hi,

    Moved your thread to development forum. Hope we can get a proper idea soon from the development professionals.


    Simon Wu
    TechNet Community Support

    Wednesday, September 4, 2013 2:07 AM