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:
2010
New-MailboxExportRequest -Mailbox tom.jones -FilePath "\\FileServer\PST_May2013\tom.jones.pst"
2007
Add-mailboxpermission -Identity tom.smith -accessrights fullaccess -user EXADMIN
Export-Mailbox -Identity tom.smith -PSTFolderPath M:\PST_May2013 -Confirm:$False