Link to home
Start Free TrialLog in
Avatar of Gui Lima
Gui Lima

asked on

How to change the display name of a bulk of shared mailboxes?

Hi guys,
I have to rename a bulk of shared mailboxes to a new format, the script is ready and works but when the script runs, the names that contains accentuation are not being updated properly and a question mark is shown where the accentuation should exist.


-----------------------------------------input file:
name,NewName
BMS-cipatubarao,"CIPA Tubarão"
BEL-liberacaeodelimbo-amd,"Liberação AMD"

-----------------------------------------Script:
$sharedChange = Import-Csv .\"SHAREDchange.csv"
$sharedChange | foreach{
      $sharedName = $_.name
      $sharedNewName = $_.newname
      try {
      # Change the DisplayName on Services Domain
            set-user $sharedname -displayname $sharedNewName
            "$(get-date -f MM/dd/yyyy-HH:mm:ss), $sharednewname, modified on, $sharedname`n" | out-file '.\SharedSuccess.txt' -append
      }      catch {
            "$(get-date -f MM/dd/yyyy-HH:mm:ss), $sharednewname, NOT modified on, $sharedname`n" | out-file '.\SharedFailed.txt' -append
      }
}
-----------------------------------------output file:
09/04/2017-17:47:12, CIPA Tubar�o, modified on, cipatubarao
09/04/2017-17:47:14, Libera��o AMD, modified on, liberacaeo-amd

What should I do?
I have already tried to use the command directly on my shell using set-mailbox liberacaeo-amd -displayname "Liberação AMD" and it works, but as I have a batch of shared mailboxes to execute this change, this is completely out of  question.
ASKER CERTIFIED SOLUTION
Avatar of J0rtIT
J0rtIT
Flag of Venezuela, Bolivarian Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gui Lima
Gui Lima

ASKER

Hi dear, thanks for you reply but this script is running from Exchange Server, in the Exchange shell.
Thanks.
Hi everyone, thanks for the support.
I've done some tests and found out that during importation the names were comming wrong, so, I've saved the input file as .csv UNICODE UTF-8. Did the tests again and everything is fine now.
Didn't know about that, but it is fixed now.

Thanks!

more info: http://blogs.catapultsystems.com/thernandez/archive/2015/09/20/how-to-export-and-import-foreign-characters-with-powershell/
Alright, he script would work with improved lines on errors. Glad you solve it, please add or mark your answers :) take care
Thanks man, nice work!