PS Exchange Export Mailbox Inbox subfolders into separate PST

Hello,

First Sorry for my English i don't practice so ...

I have a problem :

I want to export all the subfolders in the Inbox Folder to a separate pst

I have found a PS command to list the subfolders :

foreach-object { Get-MailboxFolderStatistics -Identity <MailboxID> -FolderScope Inbox | select-object Name }

Open in new window


This works perfect so i thinked that this going to work :

foreach-object {foreach-object { Get-MailboxFolderStatistics -Identity <MailboxID> -FolderScope Inbox | select-object Name } | New-MailboxExportRequest -Mailbox <MailboxID> -IncludeFolders "Inbox/$_" -FilePath \\Mypath\inbox-$_.pst }

Open in new window


But i see that we can't include pipe into pipe ...

That's where i'm stucked !

Can anyone help a PS/Exchange newbie ?
Yohann JARRIERTechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael PfisterCommented:
Can't test here but this should work:
Get-MailboxFolderStatistics -Identity <MailboxID> -FolderScope Inbox | select-object Name  | foreach-object {New-MailboxExportRequest -Mailbox <MailboxID> -IncludeFolders "Inbox/$_" -FilePath \\Mypath\inbox-$_.pst }

Open in new window

HTH
0
Yohann JARRIERTechAuthor Commented:
Thanks,

We have made a step ;) but it doesn't works because of many things :

This create at least 10 exports and stop with a error :

Le nom de chaque boîte aux lettres doit être unique. Aucun nom par défaut n'est disponible pour une nouvelle demande
détenue par la boîte aux lettres 'MailboxID'. Nettoyez les demandes existantes à
l'aide de la cmdlet Remove ou spécifiez un nom unique.
    + CategoryInfo          : InvalidArgument : (Alias:MailboxOrMailUserIdParameter) [New-MailboxExportRequest], N
   oAvailableDefaultNamePermanentException
    + FullyQualifiedErrorId : 2C7B53A1,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
    + PSComputerName        : ServerName

Open in new window


AND

I think there is a problem with the variable $ _ because here is the name of the pst file created after the export : @(name=FOLDER1) knowing that the file export does not contain the mails contained in the folder (which seems obvious if the variable does not goes back not just the name of the folder but @(name=FOLDER1)
0
Yohann JARRIERTechAuthor Commented:
I forgot to mention that I added -BatchName "$ _" in the New-MailboxExportRequest command
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

Michael PfisterCommented:
Try
Get-MailboxFolderStatistics -Identity <MailboxID> -FolderScope Inbox | select-object Name  | foreach-object {New-MailboxExportRequest -Mailbox <MailboxID> -BatchName "$($_.Name)"  -IncludeFolders "Inbox/$($_.Name)" -FilePath \\Mypath\inbox-$($_.Name).pst }

Open in new window

0
timgreen7077Exchange EngineerCommented:
To Export all the sub folders of the inbox run the following:

New-MailboxExportRequest -Mailbox "user" -IncludeFolders "#inbox#/*" -FilePath \\SERVER01\PSTFileShare\subfolders.pst
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timgreen7077Exchange EngineerCommented:
Author has any of the suggestions helped you.
0
timgreen7077Exchange EngineerCommented:
closing question since author no longer responds.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.