I'm trying to create a power shell script for EMS that will help in creating distribution groups.
I would like it to ask for the name of the group, email address and members. If i have multiple members I'm not sure how to pass that as a variable for each user name. this is what I have so far:
$distgroup = Read-Host "Enter new Distribution Group name"
$orgunit = Read-Host "Enter OU"
$emailaddress = Read-Host "Enter Email Address for the Group"
$groupmembers = Read-Host "Enter Member name"
New-DistributionGroup -Name "$distgroup" -OrganizationalUnit "$orgunit" -SAMAccountName "$distgroup" -Type "Distribution"
Set-DistributionGroup -Identity $distgroup -EmailAddresses $firstname.lastname@example.org
Set-DistributionGroup $distgroup -requiresenderauthenticationenabled:$False
Add-DistributionGroupMember -Identity "$distgroup" -Member
I'm not sure how to properly grab/pass multiple entries to the last entry. I'm still a novice at power shell but I'm trying to learn.