Hi Team
Can anyone spot anything wrong in this script. I am trying to set all email addresses and UPN to lowercase.
There are no errors and it would look as though the code is fine. However on checking an AD account the case has not changed.
Connect-QADService -Service "AR Service-HERE" -Proxy # Specify the OU where the user accounts are located $ou = "OU-HERE" # Get all user accounts in the OU $users = Get-QADUser -SearchRoot $ou # Loop through each user account and set the email address and UPN to lowercase foreach ($user in $users) { $email = $user.Email $upn = $user.UserPrincipalName if ($email) { $user.Email = $email.ToLower() Set-QADUser -Identity $user -ObjectAttributes @{email=$user.Email} } if ($upn) { $user.UserPrincipalName = $upn.ToLower() Set-QADUser -Identity $user -ObjectAttributes @{userprincipalname=$user.UserPrincipalName} } }