Came up with this script when migrating over a unit that had a few AD Groups that were mail enabled. Required that I set the no sender authentication and disable the email address policy due to they migrated their mx record as well.
#AD Setting for Multi Domain Forest
Set-ADServerSettings -ViewEntireForest $true
#Import Group Settings
$uGroups = Import-CSV "c:\users\myaccount\desktop\migrated_groups.csv"
foreach ($uGroup in $uGroups)
{
#Mail Enabled the Group
Enable-DistributionGroup -Identity $uGroup.groupid
#Add Remote Domain Primary SMTP Address to Group's Email Addresses
$uGrp = get-DistributionGroup -identity $uGroup.groupid
$uGrp.EmailAddresses += ("smtp:" + $uGroup.emailaddress)
set-DistributionGroup -identity $uGroup.groupid -EmailAddresses $uGrp.EmailAddresses
#Set No Sender Authentication and Disabled Email Address Policy
set-DistributionGroup -identity $uGroup.groupid -RequireSenderAuthenticationEnabled $false -EmailAddressPolicyEnabled $false
}
==============migrated_groups.csv==========================
groupid,displayname,emailaddress
Sales-Peps,Sales Users,SalesUsers@mydomain.edu
PurchasingUsers,Purchasing Users,PurchasingUsers@mydomain.edu
Marketing,Marketing Users,marketingUsers@mydomain.edu
No comments:
Post a Comment