Rename UPN in AD, AAD and Update Primary SMTP

tp44794,
Welcome back to the forum. :wave:t4: … long time no see.

You may start with reading

or this:

Some short recommendations:

  • Do not over comment.
    Even for human beeings not knowing PowerShell it’d some kind of obvious that
Start-Sleep -Seconds 3

does a

# Pause for 3 Seconds
  • Do not use Write-Host
    Write-Host Considered Harmful | Jeffrey Snover's blog

  • Do not post unnecessary white space or empty lines. It makes your code harder to read

  • Format your code nicely. Use indentations. Add line breaks after pipe symbols to reduse the length of your code lines.

  • Do not iterate more than once over a given array if it’s not necessary.