Question

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?

Was it helpful?

Solution

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}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top