I'm in need of a Powershell script that will edit all users email attribute within a specific OU in Active Directory.
The code below searches for the correct OU and edits the users email attributes within, however the users email attributes are being replaced with @domain.com instead of [email protected].
Is my syntax wrong: $($_.samaccountname)?
Get-ADUser -Filter * -SearchBase "OU=Test,OU=People,DC=ad,DC=domain,DC=com" | Set-ADUser -email "$($_.samaccountname)@domain.com"
I appreciate the help.