Solved

import a multi-value column

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to monitor servers ? 4 23
Exchange Server 2016 Version 3 15
Exchange 2013 - addusertopfrecursive 3 22
exchange 2007 21 10
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In-place Upgrading Dirsync to Azure AD Connect
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
how to add IIS SMTP to handle application/Scanner relays into office 365.

831 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