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.
June 5th, 2012 8: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
Free Windows Admin Tool Kit Click here and download it now
June 6th, 2012 5: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.
June 6th, 2012 6:33am