This probably sounds crazy but I was asked to do this.
Basically they wanted to stop a users to send emails to all distribution list. Usually used when terminating a user or if the user is being retarded and sending personal emails to all DL's. Whatever it might be I just had to come up with a script to do it to all over 150 DL. I wasn't going to do it one by one from EMC so I made a cmdlet.
Below is the powershell script for exchange 2010 probably works on 2013 as well.
Make a DL called "Denied Users" and add users or user to that DL if you want to block him from sending emails to DL. Please note that this script will only add the Denied User DL in block list once. So if you create a new DL after running this script. Then that DL will not have Denied users in rejected user and hence you will have to re-run the script.
$temp = Get-DistributionGroup -ResultSize Unlimited
foreach($group in $temp)
{
Set-DistributionGroup -Identity $group -RejectMessagesFromDLMembers "Denied Users"
}
#Remove the above setting incase they change their mind.
#Set-DistributionGroup -Identity $group -RejectMessagesFromDLMembers $null
Basically they wanted to stop a users to send emails to all distribution list. Usually used when terminating a user or if the user is being retarded and sending personal emails to all DL's. Whatever it might be I just had to come up with a script to do it to all over 150 DL. I wasn't going to do it one by one from EMC so I made a cmdlet.
Below is the powershell script for exchange 2010 probably works on 2013 as well.
Make a DL called "Denied Users" and add users or user to that DL if you want to block him from sending emails to DL. Please note that this script will only add the Denied User DL in block list once. So if you create a new DL after running this script. Then that DL will not have Denied users in rejected user and hence you will have to re-run the script.
$temp = Get-DistributionGroup -ResultSize Unlimited
foreach($group in $temp)
{
Set-DistributionGroup -Identity $group -RejectMessagesFromDLMembers "Denied Users"
}
#Remove the above setting incase they change their mind.
#Set-DistributionGroup -Identity $group -RejectMessagesFromDLMembers $null
No comments:
Post a Comment