Changing ProxyAdress field values

by hunterz at 2012-12-06 03:57:53


I am not expert in powershell, so asking for some help here!
I have such case.

Current situation]
I need to change ProxyAdress values in AD 2008 for users who have them (not all users have them, ones without proxyAdress dont need any changes). Atm users have 1 e-mail adress in proxyAdress field ""

Need to achieve]
So adress must become primary adress, in meantime keeping as secondary adress

Posible problems]
Its not my own created domain, e-mails never was on Exchange, they had Lotus backdays and i am not sure about exact match beatwean e-mails name.surname with AD field values GivenName and sn.
So from my point of understanding safest way to avoid any problems with this would be:
change to in ProxyAdress field (to keep it as primary e-mail adress) and then add new record “”, by taking name.surname part from ProxyAdress field.

Could any powershell expert can help me to achieve this goal?
by kittH at 2012-12-06 06:56:49
There are a few ways to do it, but we need to be careful we don’t overwrite the wrong information.
Do the users have any other information in the proxyaddresses field? Do any of the users have multiple SMTP addresses that will need to be accounted for?

Here is one attempt, but please test thoroughly before removing the whatif, as it may have unexpected effects if you have other types of domain addresses in there (SIP for example)

Foreach ($User in (Get-QADUser)){
$OldSMTP = $User.ProxyAddresses | Select-String “SMTP” | Select -ExpandProperty Line
$Proxy = $User.ProxyAddresses.Replace(“”, “”)
$Proxy += $OldSMTP
Set-QADUser $User -ObjectAttributes @{ProxyAddresses=$Proxy}}}
by hunterz at 2012-12-07 02:46:31
Thanks for script!!! Will test it carefully. No, atm users have only 1 value in proxyAddress, multivalues. And there are no other information, except one listed above. So no things to worry about. :slight_smile: