Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

remove smtp address from a csv file

$
0
0

Hi Guys,

I found several article already about these tasks but so far it hasnt worked for me. I have a script similar below and it works but I suspect it worked because its for single value properties. But for multi-valued properties as proxy addresses it just wouldnt work. Any suggestions?

Initially I  made a script that search for all users that contains a specific proxy address (e.g contains*@invalidDomain.com) then stores it in a CSV file.  The CSV file just contains the columns DisplayName,Alias and EmailAddresses (which only have the*@invalidDomain.com in it)

Then created a second script to parse through this csv file to delete the invalid domain on the account.

#####SCRIPT BEGINS#####
$mailboxes=import-csv "CSV_path.csv"
$mailboxes | foreach {
get-mailbox -identity $_.Alias | where {$_.EmailAddresses -like "*@barclaysibim.com"} | set-mailbox $mailboxes -EmailAddresses @{remove=$_}
}  
#####ENDS##############

Given Conditions:
- Exchange 2007 with powershell ver. 1.0
- scattered in Multiple OU's
- users have multiple proxy addresses
- tried the advise given on this link but still fails


PoSH newbie, BaSH Oldie



Viewing all articles
Browse latest Browse all 15028

Trending Articles