Solved

import a multi-value column

Posted on 2014-09-07
4
398 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
  • 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 18

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

The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
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…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now