Hello,<\/p>\n
I’m looking for some help with a PowerShell script. I need a script that will copy the primary SMTP proxyaddress into the mail attribute within AD. Since moving Exchange to Office 365, the E-Mail address field in the General Tab for an AD user doesn’t get populated anymore.<\/p>\n
Any help would be greatly appreciated.<\/p>\n
Thanks.<\/p>","upvoteCount":3,"answerCount":5,"datePublished":"2018-04-16T11:40:02.000Z","author":{"@type":"Person","name":"joeymartinez","url":"https://community.spiceworks.com/u/joeymartinez"},"acceptedAnswer":{"@type":"Answer","text":"
Found a way to do this. Below is my script for one user. Shouldn’t be difficult to run this across the domain or certain OU at this point.<\/p>\n
$User = “test.test”
\n$address = Get-ADUser $user -Properties proxyAddresses | Select -Expand proxyAddresses | Where {$_ -clike “SMTP:*”}
\n$address = $address.SubString(5)
\nSet-ADUser $user -Email $address<\/p>\n
Hope this helps someone else.<\/p>","upvoteCount":0,"datePublished":"2018-04-16T12:51:29.000Z","url":"https://community.spiceworks.com/t/copy-primary-smtp-proxyaddress-to-mail-attribute/646347/3","author":{"@type":"Person","name":"joeymartinez","url":"https://community.spiceworks.com/u/joeymartinez"}},"suggestedAnswer":[{"@type":"Answer","text":"
Hello,<\/p>\n
I’m looking for some help with a PowerShell script. I need a script that will copy the primary SMTP proxyaddress into the mail attribute within AD. Since moving Exchange to Office 365, the E-Mail address field in the General Tab for an AD user doesn’t get populated anymore.<\/p>\n
Any help would be greatly appreciated.<\/p>\n
Thanks.<\/p>","upvoteCount":3,"datePublished":"2018-04-16T11:40:02.000Z","url":"https://community.spiceworks.com/t/copy-primary-smtp-proxyaddress-to-mail-attribute/646347/1","author":{"@type":"Person","name":"joeymartinez","url":"https://community.spiceworks.com/u/joeymartinez"}},{"@type":"Answer","text":"
What have you tried so far?<\/p>","upvoteCount":1,"datePublished":"2018-04-16T12:35:53.000Z","url":"https://community.spiceworks.com/t/copy-primary-smtp-proxyaddress-to-mail-attribute/646347/2","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},{"@type":"Answer","text":"
This will be more effective for entire users<\/p>\n
$Users = Get-ADUser -Filter {proxyAddresses -like '*'} -Properties proxyAddresses | Select sAMAccountName, proxyAddresses\nForEach ($User In $Users)\n{\n $Name = $User.sAMAccountname\n $Addresses = $User.proxyAddresses\n ForEach ($Address In $Addresses)\n {\n If ($Address -cmatch \"SMTP:\")\n {\n $ad=$Address.SubString(5)\n set-aduser $name -mail $ad\n }\n }\n}\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2018-04-16T12:55:03.000Z","url":"https://community.spiceworks.com/t/copy-primary-smtp-proxyaddress-to-mail-attribute/646347/4","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},{"@type":"Answer","text":"Also, If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>