powershell exchange 2010 assistance with creating groups

Good evening I have this script and it actually create the groups. The problem I am having is I would like for it to enable the requiresenderauthenticationenabled and also if I have multiple email addresses for the distro list to pick this up from the spreadsheet.

Here is the command I use to add additional addresses for a distro list. I am not sure how to incorporate this into the script

Set-DistributionGroup "group1" -EmailAddresses SMTP:group1@domain.com,group1a@domain.com, bdf@yahoo.com

This is the script which is functional except for the portion of requiresenderauthenticationenabled.

 $CSV = Import-CSV C:\temp\ImportDL.csv

 foreach ($distrolist in $Csv} {
 New-distributiongroup -Name $distrolist.DisplayName -DisplayName  $distrolist.DisplayName -samaccountname $distrolist.samaccountname -alias  $distrolist.alias -OrganizationalUnit $distrolist.OrganizationalUnit

 | % set-distributiongroup  $distrolist.alias -requiresenderauthenticationenabled -confirm:$false
Who is Participating?
Add email address with header EmailAddresses in csv file and try with following code...
$CSV = Import-CSV C:\temp\ImportDL.csv
foreach ($distrolist in $Csv) {
	$EmailAddresses = @()
	$distrolist.EmailAddresses -split "," | % {
	$EmailAddresses += "SMTP:$($_)"
New-distributiongroup -Name $distrolist.DisplayName -DisplayName $distrolist.DisplayName -samaccountname $distrolist.samaccountname -alias $distrolist.alias -OrganizationalUnit $distrolist.OrganizationalUnit |
Set-Distributiongroup -EmailAddresses $EmailAddresses -RequireSenderAuthenticationEnabled $False -EmailAddressPolicyEnabled $false -confirm:$false

Open in new window

techdriveAuthor Commented:
thanks you are the man
Don't forget to close this question, If you don't have any further question regarding this script.. :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.