Question : Script to remove smtp proxy address from contacts in single OU

Hi!

Can anyone assist with a quick powershell or .vbs script to remove a single proxy address from a big bunch of AD contacts in the same OU?

I have a large number of contacts and a legacy address policy has been applied adding a proxy address @MyNaffOrg.com

I want to remove all proxy addresses that end with @MyNaffOrg.com from all the contacts that exist in one single OU without removing the targetAddress or associated proxyAddresses.

Much appreciated!
Coopz

Answer : Script to remove smtp proxy address from contacts in single OU


Hey Coopz,

Something like this?

Chris
1:
2:
3:
4:
5:
6:
7:
$OU = [ADSI]"LDAP://OU=Contacts,DC=yourdomain,DC=com"
ForEach ($Contact in $OU.PsBase.Children) {
  $Contact.Get("proxyAddresses") | ?{ $_ -Like "*@MyNaffOrg.com" } | %{
    $Contact.PutEx(4, "proxyAddresses", @("$_"))
    $Contact.SetInfo()
  }
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us