Tuesday, May 7, 2013

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

No comments:

Post a Comment