I would like to replace some characters "before user creation". With character like umlaute "ä", "ö", "ü". The script works. But characters like "é", "ô" doesn't seem to be replaced.
Im using this script:
$props = @("sAMAccountName", "userPrincipalName", "mail")
$map =@{ " " ="";"Á"="A";"Ă"="A";"Â"="A";"Å"="A";"Ä"="Ae";"Ǟ"="Ae";"Ã"="A";"Ą"="A";"Ā"="A";"Ć"="C";"Ĉ"="C";"Ċ"="C";"Ç"="C";"Ď"="D";"Ḑ"="D";"Đ"="D";"Ð"="D";"É"="E";"Ê"="E";"Ě"="E";"Ë"="E";"Ė"="E";"Ę"="E";"Ē"="E";"Ğ"="G";"Ĝ"="G";"Ġ"="G";"Ģ"="G";"Ĥ"="H";"ħ"="h";"İ"="I";"ı"="i";"Í"="I";"Ì"="I";"Î"="I";"Ï"="I";"Ĩ"="I";"Ī"="I";"Ĵ"="J";"Ķ"="K";"Ĺ"="L";"Ļ"="L";"Ł"="L";"Ŀ"="L";"Ń"="N";"Ň"="N";"Ñ"="N";"Ņ"="N";"Ŋ"="N";"Ó"="O";"Ò"="O";"Ô"="O";"ö"="oe";"Ȫ"="Oe";"Ő"="Oe";"Õ"="O";"Ȯ"="O";"Ø"="O";"Ř"="R";"Ŕ"="R";"Ŗ"="R";"Ś"="S";"Ŝ"="S";"Š"="S";"Ş"="S";"Ṣ"="S";"Ș"="S";"ß"="ß";"Ť"="T";"Ţ"="T";"Ț"="T";"Ŧ"="T";"Ú"="U";"Ù"="U";"Ŭ"="U";"Û"="U";"Ů"="U";"Ü"="Ue";"Ű"="Ue";"Ŵ"="W";"Ý"="Y";"Ŷ"="Y";"Ÿ"="Y";"Ȳ"="Y";"Ź"="Z";"Ž"="Z";"Ż"="Z";}
foreach ($prop in $props)
{
if ($Context.IsPropertyModified($prop))
{
$value = $Context.GetModifiedPropertyValue($prop)
foreach ($key in $map.Keys)
{
$value = $value.Replace($key, $map[$key])
}
$Context.SetModifiedPropertyValue($prop, $value)
$Context.LogMessage($prop + ": " + $value, "Information")
}
}
If i add lower and upper case i get an error message: "Duplicate keys are not allow in hash literals"
I know some characters are automatically interpreted as normal characters from AD, but with the mail address and upn we have some issues with it in the Azure World. Do you have a solution for this?