Import (New or) Set Distribution Groups with CSV Powershell

I need to create new distribution groups into Active Directory with these attributes (as the headers):

DisplayName      Alias      LegacyExchangeDN      PrimarySmtpAddress      ManagedBy      EmailAddresses      EmailAddresses02      EmailAddresses03      EmailAddresses04

How would we utilize a CSV of this nature to create/populate all the Distribution Groups?
Thank you!
LVL 8
K BAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael PfisterCommented:
0
K BAuthor Commented:
Thank you for your reply. However, I have seen this page before and I don't see any that reference a CSV.
0
Michael PfisterCommented:
Scroll down to
"Create Bulk Distribution Groups from a CSV File"
HTH
0
INTRODUCING: WatchGuard's New MFA Solution

WatchGuard is proud to announce the launch of AuthPoint, a powerful, yet simple, Cloud-based MFA service designed to eliminate the vulnerabilities that put your data, systems, and users at risk.

Michael PfisterCommented:
Of yourse you have to add add'l parameters for the other fields you need.

Can't check right now if you can provide all required fields with New-DistributionGroup. It might be necessary to do an extra loop for example to set the owner or add add'l mail addresses.
0
K BAuthor Commented:
All the required fields are in the original question. Again, thank you for your reply.
0
Michael PfisterCommented:
As I told you I can't check this now so this is just theory

Import-CSV C:\Temp\DL-Group.csv | ForEach {New-DistributionGroup -Name $_.DisplayName -DisplayName $_.DisplayName  -Alias $_.Alias  -PrimarySmtpAddress $_.PrimarySmtpAddress -ManagedBy $_.ManagedBy -Type "Distribution"}

Import-CSV C:\Temp\DL-Group.csv | ForEach {$AddressList = "SMTP:"+$_.EmailAddresses + "," + $_.EmailAddresses02+ "," + $_.EmailAddresses03 + "," + $_.EmailAddresses04
	Set-DistributionGroup $_.DisplayName -EmailAddresses $AddressList 
	Set-ADGroup -Identity $_.DisplayName -add @{proxyAddresses=”X500:$($_.LegacyExchangeDN)}
}
      

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.