Exchange 2007 – “Modify Accept Messages only from” for Distribution List

Hi Readers,

I have been given a task to update the “accept Messages only from” field for a distribution list.

Below is the short & sweet script I have written to accomplish it.

This script reads from csv file user ids that needs to be added

name
user1
user2
user3

##############################################################                                                                                           
##           Author: Vikas Sukhija                                                  ##
##           Date: 02-05-2013                                        ##
##           Description:- Add user to acceptmessages only from                               ##
##                                                                   ##        
##############################################################

import csv file

$data = import-csv $args[0]

$group = “groupnamehere”
#

foreach ($i in $data)

{

$id = $i.name
$mailbox = get-mailbox $id
Write-host $mailbox
Set-DistributionGroup $group -AcceptMessagesOnlyFrom((Get-DistributionGroup $group).AcceptMessagesOnlyFrom + $id )
}

################################################################

Regards

Sukhija Vikas

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