?
Solved

import a multi-value column

Posted on 2014-09-07
4
Medium Priority
?
500 Views
Last Modified: 2014-09-08
I have an assignment to add multiple managers to a distribution group. What is the easiest way to import multiple owners from a csv file. I was trying this way but it only works for one persons name.


import-csv c:\temp\groupfiles.csv | foreach {get-distributiongroup -name $_.name | set-DistributionGroup  $_.managedby | select displayname, alias, @{name='managedby';Expression={[string]::join(";", ($_.Managedby))}},  identity
0
Comment
Question by:techdrive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 40309358
Try..
Import-Csv C:\temp\groupfiles.csv | % { Set-Distributiongroup $_.Name -managedby $_.Manager }

Open in new window

or
Import-Csv C:\temp\groupfiles.csv | % { Set-Distributiongroup $_.Name -managedby ($_.Manager -split ",") }

Open in new window

Sample csv input..
"Name","Manager"
"GroupA","UserA,UserB,UserC"
"GroupB","UserA,UserB,UserD"

Open in new window

Ps : The code will replace existing managedby information.
0
 
LVL 19

Expert Comment

by:suriyaehnop
ID: 40309770
To confirmed the no.2 provided by Subsun is working. Tested in my lab.
0
 

Author Comment

by:techdrive
ID: 40310624
thanks subsun
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 40310894
You're Welcome!.. Please don't forget to close the questions.. :-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question