Export Mailboxes to PST using CSV

Hello - I'm in the process of exporting mailboxes from another exchange server from a company we acquired so I can import email into their new mailbox. I have a CSV formatted with headers old,new which has their old alias and new alias. I also only want to capture the last 60 days of email. However, I seem to be missing something in formatting as it keeps creating a new line instead of just executing the script. I'm at a loss and can't seem to get this working.

 

$sixty = get-date -format "M/d/yyyy" (get-date).AddDays(-60)
$UserList=Import-CSV C:\users.csv
FOREACH ($Person in $UserList) {
New-MailboxExportRequest -Mailbox $Person.old -ContentFilter {(MessageKind -eq 'Email') -and (Received -gt $sixty) -or (Sent -gt $sixty)} -FilePath "\\server\pst\"$Person.new".pst"
}

Any help would be appreciated!

February 24th, 2015 2:39pm

Try

 

$sixty = get-date -format "M/d/yyyy" (get-date).AddDays(-60)
$UserList=Import-CSV C:\users.csv
FOREACH ($Person in $UserList) {
New-MailboxExportRequest -Mailbox $Person.old -ContentFilter {(MessageKind -eq 'Email') -and ((Received -gt $sixty) -or (Sent -gt $sixty))} -FilePath "\\server\pst\$($Person.new).pst"
}


Free Windows Admin Tool Kit Click here and download it now
February 24th, 2015 4:57pm

The above provided command looks good to export mailboxes into PST as per specific requirement.

However, if you still unable to accomplish this task, I would suggest you to have a look on this automated solution (http://www.exchangemailboxtopst.org/) that could be a good alternative approach to get this job done in more easier way.

February 25th, 2015 2:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics