Solved

import a multi-value column

Posted on 2014-09-07
4
411 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

Why are Office 365 signatures so complicated?

Trying to setup transport rules for Office 365 email signatures and can’t quite figure it out? Having to test the signature over and over? Make things simple by using Exclaimer Cloud - Signatures for Office 365.

Question has a verified solution.

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

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.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…

914 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

18 Experts available now in Live!

Get 1:1 Help Now