Forum Discussion
Satish_krishna91
May 18, 2021Copper Contributor
Need to Replace non english characters with english alphabets
Hi Team, Can someone help me how to replace these characters [ÄäËëÏïÖöóÜüŸßáčďéěíňóřšťúůýž ] with normal English alphabets in on premises Active Directory on UserPrincipalName using PowerShell sc...
NZScottie
May 19, 2021Copper Contributor
Give the following a try.
It should be easy to modify with the rest of the characters you require to replace.
I have written it on the fly so the syntax may not be quite correct.
Make sure you run this on a small subset of users or better still some test users before running in production.
# Filter this down to a small set to test with before running over all users in domain.
$ADUsers = Get-ADUsers -filter *
foreach ($ADUser in $ADUsers) {
$NewUPN = $ADUser.UserPrincipalName
switch -Regex -CaseSensitive ($ADUser.UserPrincipalName) {
'Ä' { $NewUPN = $NewUPN -replace 'Ä','A' }
'ä' { $NewUPN = $NewUPN -replace 'ä','a' }
'Ë' { $NewUPN = $NewUPN -replace 'Ë','E' }
'ë' { $NewUPN = $NewUPN -replace 'ë','e' }
}
$ADUser | Set-ADUser -UserPrincipalName $NewUPN
}
Let me know how you get on.