Solved

import a multi-value column

Posted on 2014-09-07
4
477 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 500 total points
ID: 40310894
You're Welcome!.. Please don't forget to close the questions.. :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
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…
In this video we show how to create an Address List 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 Organization >> Ad…
This video discusses moving either the default database or any database to a new volume.

707 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