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!
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:
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.
Michael PfisterCommented:
Scroll down to
"Create Bulk Distribution Groups from a CSV File"
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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.
K BAuthor Commented:
All the required fields are in the original question. Again, thank you for your reply.
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

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

From novice to tech pro — start learning today.