Some time ago I had already a problem here with the value "MailNickname", which means that the address lists cannot be updated.
The same problem can occur with e-mail activated public folders. The background to this is that in Exchange 2003 times the mail nickname (alias) was still allowed to contain special characters such as spaces etc.. This is no longer the case with Exchange 2010. If you want to display an e-mail-enabled folder, you will also receive a warning on the shell:
Get-MailPublicFolder Test3
WARNING: The object frankysweb.local/Microsoft Exchange System Objects/Test3 has been corrupted and is located in
an inconsistent state. Verification error:
WARNING: Property expression "Test3 " is invalid. Valid values: character strings consisting of the letters A to Z
(upper and lower case letters), numbers from 0 to 9, !, #, $, %, , ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~.
At least one point can be embedded in an alias, but each point must have at least one of the other points embedded in it.
character must precede and follow the alias. Unicode characters from U+00A1 to U+00FF are also valid in an alias,
However, they are stored in the e-mail address created from such an alias with as good a match as possible to a
US-ASCII character string assigned.
I now had the case that there were a large number of e-mail activated public folders, all of which had special characters in the alias/mail nickname. Sometimes spaces or brackets at the end or in the middle.
To avoid having to change all folders manually, I have built a small script that deletes all special characters from the alias
#——————————
# www.FrankysWeb.de
#——————————$mailfolders = Get-MailPublicFolder -WarningAction SilentlyContinue | Where-Object {$_.Alias -match "\W"}
if ($mailfolders -eq $Null)
{
write-host ""
write-host "No special characters found!"
write-host ""
}
else
{
foreach ($mailfolder in $mailfolders)
{
$rightalias = $mailfolder.alias -replace"\W",""
write-host "Folder $mailfolder is changed. New alias: $rightalias"
set-mailpublicfolder "$mailfolder" -alias "$rightalias"
}
}
Simply copy the script into a PS1 file and execute it. Unfortunately, the script throws the warning as above for each folder with special characters when creating the public folders:
However, the warnings do not affect the function
Funktioniert mit einer Einschränkung gut, wenn mehrere Aliase gleich lauten würden durch die Änderung kommt es zu Fehlern. (The Operation could not performed because ‚xyz‘ matches multiple entries.) Da wäre noch eine Abfangklausel nötig.