ADD / Remove ProxyAddresses from Active directory Attributes

After Migration or Removing some domain from organisation, you might also need to remove SMTP address lists from Adctive directory.

For example: I have removed a domain techexchange.fr from my active directory and now i want to remove all the SMTP:user@techexchange.fr from “ProxyAddresses” in active directory.

To do this, open notepad and write this code given below and then save it as scriptname.ps1

Import-Module Activedirectory

GC C:input.txt | % {

Set-ADUser $_ -Add @{ProxyAddresses="SMTP:$_@techexchange.fr"}

}

DEC-0054

 

If you want to remove Proxy Addresses then replace -Add with -Remove

and the input.txt file be containing all the usernames like:

DEC-0052

place the input file in c:input.txt and run the script.

Voila

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s