-1

I am trying to run a batch file which runs powershell script (Export-mailbox -identity admin -pstFolderPath \srv02\d$\test)

I have been running the export-mailbox command manually to export 20 mailboxes. I would like to make this process as a script so I can run it everyday to make a backup of all mailboxes with pst files.

Does anyone know how to do this?

1 Answer 1

0

You can list the mailboxes you want to export into a csv file then import the csv file in the batch to export each mail item. Something like...

$Mailboxes=Import-Csv \\srv02\d$\test\mailboxes.csv
$Mailboxes | ForEach-Object{Export-mailbox -identity admin -pstFolderPath \srv02\d$\test}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.