Tag Archives: Public Folders

How to bulk fix inconsistent Exchange Public Folders

This often happens in Exchange 2003 – 2007/2010 migrations with large public folder infrastructures.  Before Exchange 2007, public folder aliases were very relaxed with requirements and allowed a space.  Now those days are over and all the spaces must be removed, but the question is….how?  There are a few guides out there, but unfortunately most of them leave out crucial commands so I will go through my procedure step by step.

 

WARNING: Object domain.com/Microsoft Exchange System Objects/Bob Jones has been corrupted and it is in an inconsistent state. The following validation errors have occurred:

WARNING: “Bob Jones” is not valid for Alias. Valid values are: Strings formed with characters from a to z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &,’, *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more periods may be embedded in an alias, but each one of them should be preceded and followed by at least on of the other characters. Unicode characters from U+00A1 to U+00FF are also valid in an alias, but they will be mapped to a best-fit US-ASCII string in the email address which is generated from such an alias”

 

  1. Determine which public folders are inconsistent.
    get-publicfolder -identity “” -recurse -resultsize unlimited | get-mailpublicfolder | Where {$_.Alias -like “* *”}

    How to export to csv
    get-publicfolder -identity “” -recurse -resultsize unlimited | get-mailpublicfolder | Where {$_.Alias -like “* *”} | select name | export-csv exportlist.csv

    You can also get a line count by using the status bar in notepad.  If the option is disabled, uncheck wordwrap

  2. Fix the inconsistency
    First decide which character you’re going to replace it with and make sure it works with your email naming scheme.  For example, lets use an underscore ( _ ).

    get-publicfolder -identity “” -recurse -resultsize unlimited | get-mailpublicfolder | Where {$_.Alias -like “* *”}  | ForEach-Object {Set-mailpublicfolder $_.name -alias:($_.Alias -replace ” “,”_”)}

    If you wanted to use a period (.), this would be the command…
    get-publicfolder -identity “” -recurse -resultsize unlimited | get-mailpublicfolder | Where {$_.Alias -like “* *”}  | ForEach-Object {Set-mailpublicfolder $_.name -alias:($_.Alias -replace ” “,”.”)}

 

As always, test out these commands on lower level Public Folders before running it against the root!!!