Announcement

Collapse
No announcement yet.

Exchange 2007 Mailbox Export to PST - Exclude subfolder in \Inbox

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exchange 2007 Mailbox Export to PST - Exclude subfolder in \Inbox

    I've been working on this for hours and have run into just a couple of articles. A user mailbox has a ton duplicate folders under the \INBOX that keeps growing. I am looking to completely export the mailbox to PST but 'exclude' all of the subfolders under Inbox while still keep everything that is in the Inbox.

    I got this option from the following website (http://serverfault.com/questions/117...ing-subfolders). I have a syntax issue in the method call but don't know where it is Missing ')' in method call.

    $r = [regex]'/';

    $exclude = Get-Mailbox -Identity mailtest | Get-MailboxFolderStatistics | where {$_.folderpath -ne "/" -and $_.FolderPath -ne "/Inbox"} | Select-Object FolderPath | Foreach {$_.folderpath.tostring()} | foreach {$r.replace($_,\,-1)}

    I got the following error message:

    *********************

    [PS] H:\>$r = [regex]'/';

    [PS] H:\>$exclude = Get-Mailbox "mailtest" | Get-MailboxFolderStatistics | where

    {$_.folderpath -ne "/" -and $_.FolderPath -ne "/Inbox"} | Select-Object FolderP

    ath | Foreach {$_.folderpath.tostring()} | foreach {$r.replace($_,\,-1)}

    Missing ')' in method call.

    At line:1 char:217

    + $exclude = Get-Mailbox "mailtest" | Get-MailboxFolderStatistics | where {$_.f

    olderpath -ne "/" -and $_.FolderPath -ne "/Inbox"} | Select-Object FolderPath |

    Foreach {$_.folderpath.tostring()} | foreach {$r.replace($_ <<<< ,\,-1)}

    + CategoryInfo : ParserError: (CloseParenToken:TokenId) [], Paren

    tContainsErrorRecordException

    + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

    ************************

    I decided to run the following command but this is if I am exporting to a 'target mailbox'.

    Export-Mailbox -TargetMailbox mailtest -TargetFolder C:\MAILTEST -ExcludeFolders "\Inbox","\Delete this Folder"

    I'd like to just export the mailbox to a PST and 'exclude' all of the duplicate subfolders under \INBOX. I still need the emails in the INBOX. Then delete and recreate the mailbox. Then I want to 'import' the PST into the mailbox.

    Does anyone have any thoughts on this?

    Thanks in advance.
    Verbalh
    CCNA, MCSE, MCP, Network+, CNA, A+

  • #2
    Re: Exchange 2007 Mailbox Export to PST - Exclude subfolder in \Inbox

    you mention it works to export to anoter mailbox correctly.
    you could double-hop it. (to another mailbox, then to a pst) Sure, it'd be annoying, but it would do the job.
    Please do show your appreciation to those who assist you by leaving Rep Point https://www.petri.com/forums/core/im.../icon_beer.gif

    Comment


    • #3
      Re: Exchange 2007 Mailbox Export to PST - Exclude subfolder in \Inbox

      Actually the problem is running while exporting all the duplicate subfolders under the INBOX.....

      That does not work. I can do a normal exclude at the top level but not below. I only want to exclude the folder below but keep the parent
      Verbalh
      CCNA, MCSE, MCP, Network+, CNA, A+

      Comment

      Working...
      X