Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need a script that will change all of my ad users email contact field information. The format will be the "SAMAccountName + @domain.com". I am a powershell noob and need a little help on the syntax. Any help would be appreciated.

share|improve this question
if you are using Exchange, E-mail Address Policies are the way to go for this –  August Feb 6 '13 at 17:50
Do you have available the ActiveDirectory Powershell modules? Is your domain 2008R2, or do you have Active Directory Management Gateway Service installed? –  jscott Feb 6 '13 at 18:20
I do not have active directory powershell modules installed yet and yes my domain is 2008 r2. –  user157877 Feb 6 '13 at 19:21

1 Answer 1

Here is what I would do:

Install the Active Directory Powershell Module

Script it like this:

Import-Module ActiveDirectory
$users = Get-ADUser -Filter *
foreach ($user in $users)
    $email = $user.samaccountname + '@domain.com'
    Set-ADUser -Identity $user.samaccountname -EmailAddress $email
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.