Wanted: Network Administrators

See great job listings on the jobs Page

add object to AcceptMessagesOnlyFromDLMembers for multiple groups

Hi,
I need to add a DL to AcceptMessagesOnlyFromDLMembers attribute of SOME groups (not only one)
I have a powershell commad to do it for only one group.
Set-DistributionGroup -id 'DL01' -AcceptMessagesOnlyFromDLMembers ((Get-DistributionGroup 'DL01').AcceptMessagesOnlyFromDLMembers + 'InfoDL')
I get my DL list with,

Get-DistributionGroup -ResultSize unlimited -OrganizationalUnit domain.local/hosting/customer.com | where {($_.AcceptMessagesOnlyFrom -like "*") -or ($_.AcceptMessagesOnlyFromDLMembers -like "*")}

I want to add InfoDL to restrictions of customers.com DLs.

What is the best way to do it?



Those who are skilled in combat do not become angered, those who are skilled at winning do not become afraid. Thus the wise win before the fight, while the ignorant fight to win.

Need to support users over the internet? click here try our remote control online beta






June 5th, 2012 5:12am
Hi
You can try the Script below
$dls = Get-DistributionGroup -ResultSize unlimited -OrganizationalUnit domain.local/hosting/customer.com | where {($_.AcceptMessagesOnlyFrom -like "*") -or ($_.AcceptMessagesOnlyFromDLMembers -like "*")}
Foreach($dl in $dls){
Set-DistributionGroup -id $dl.Alias -AcceptMessagesOnlyFromDLMembers ((Get-DistributionGroup $dl.Alias).AcceptMessagesOnlyFromDLMembers + 'InfoDL')
}
Hope it works
CheersZi Feng

TechNet Community Support

There is an amazing pack of free network admin tools. click here to download it






June 6th, 2012 2:30am
As it is a hosted environment sometimes alias may match multiple objects. For those objects, it throw an error.
Thank you for your help.

There is an amazing pack of free network admin tools. click here to download it






June 6th, 2012 3:33am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics