renaming an exchange folder RRS feed

  • Question

  • Let me start off by saying i am not well versed with powershell.   

    We have a document management system that put an "@" sign at the end of folders being profiled.   We have thousands of these under each users mailbox.   I need to come up with a solution that will recursively search all mailboxes and remove this symbol.   I have been testing with my own account but using the "#" sign since i still need the @ sign until we fully migrate of the old document management system.   

    I have cobbled this together and can find the folder in my mailbox, but can't seem to find a set of commands to remove it.   

    Below are the commands I run to get my mailbox and search for any folder with a ‘#’ sign.   

     [PS] C:\Windows\system32>$s=get-mailbox -identity "wklaus"

    Creating a new session for implicit remoting of "Get-Mailbox" command...


    [PS] C:\Windows\system32>$s |Select-Object alias | foreach-object {Get-MailboxFolderStatistics -Identity $_.alias |where

    -object {$_.name -like "*#*"}| select-object Identity, ItemsInFolder, FolderSize}


    Identity                                                          ItemsInFolder FolderSize

    --------                                                          ------------- ----------

    wklaus\Austin#                                                                2 292 B (292 bytes)





    I can find the mailbox with the character, but I can’t seem to find the right powershell command to remove or replace it.   I’ve tried


    $s|if ($_.name -Match '#') {$_.name = ($_.name -replace "#","")}

    I’ve tried adding this into the main command but mostly end up with errors.  

    [PS] C:\Windows\system32>$s |Select-Object alias | foreach-object {Get-MailboxFolderStatistics -Identity $_.alias |where

    -object {$_.name -like "*#*"}| If ($_.Name -Match '#' ) {$_.Name = ($_.name -replace "#","")}



    Any help would be greatly appreciated!!

    • Moved by Bill_Stewart Monday, March 12, 2018 8:36 PM Unanswerable drive-by question
    Monday, January 22, 2018 9:18 PM

All replies