Set proxy address to equal the mail address

I found this script below and I am trying to modify it to pull the mail attribute and place it in the proxy addresses. My problem is some emails are not the same as the account name.

Import-Module ActiveDirectory $users = Get-ADUser -SearchBase ‘OU=example,OU=example,DC=example,DC=org,DC=uk’ -filter * foreach ($user in $users) { $email = $user.samaccountname + '' $newemail = "SMTP:"+$email Set-ADUser $user -Add @{proxyAddresses = ($newemail) } 

submitted by /u/Snack_Happy
[link] [comments]

Leave a Reply