Managing Non-Delivery Reports
All the administrators managing Exchange have to deal with Non-Delivery reports. These are automated messages that are sent to senders if Exchange is unable to deliver a message to a recipient or a distribution group. In large Exchange organizations, it is a task for administrators to remove the users who have left the organization from the existing e-mail enabled groups. Here is a simple script that will ask for SamAccountName
for the user and remove the group membership of that user account:
Save this file as UserDGCleanup.ps1
and use the following syntax:
.\UserDGCleanup.ps1 –SamAccountName <usersamaccountname>
Example:
.\UserDGCleanup.ps1 –SamAccountName johnd
Here is the script
param ( [Parameter(Mandatory=$true)][String]$SamAccountName ) #Imports the ActiveDirectory Module to execute the AD commandlets Import-Module -Name ActiveDirectory # Get the Distinguished name of the user from the Specified SAMAccount Name $UserDistinguishedName = Get...