Solved

Creating Distribution Groups in bulk using Powershell---error

Posted on 2013-01-25
4
1,129 Views
Last Modified: 2013-01-25
I am trying to create Distribution Groups using the following scritp:


Import-CSV "D:\NewDL3.csv" | foreach {New-DistributionGroup -Name $_.name -Type $_.Type }


and I'm getting the following error: (See attachment for csv being used)  Any thoughts?

Cannot process argument transformation on parameter 'Type'. Cannot convert null to type "Microsoft.Exchange.Management.
RecipientTasks.GroupType" due to invalid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Distribution, Security".
    + CategoryInfo          : InvalidData: (:) [New-DistributionGroup], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,New-DistributionGroup
NewDL3.csv
0
Comment
Question by:K Anthony O365
  • 2
4 Comments
 
LVL 19

Expert Comment

by:R--R
ID: 38818793
Add value security or universal in the type in the csv file and run command again.
0
 
LVL 19

Expert Comment

by:R--R
ID: 38818833
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 38818872
There is a space added in the header of your CSV after Type..remove that space and run the script. Then it should work..

'Name,Type '

CSV format..
Name,Type
All Employees  USA-New York Corporate,Distribution
All Employees  USA-New York ,Distribution

Open in new window

NewDL3.csv
0
 

Author Closing Comment

by:K Anthony O365
ID: 38819431
Yes, the space in the "Type" column field was the issue!<br /><br />Thanks!
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

Utilizing an array to gracefully append to a list of EmailAddresses
A brief introduction to what I consider to be the best editor for PowerShell.
In this video we show how to create a Contact 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 >> Contact ta…
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

911 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

17 Experts available now in Live!

Get 1:1 Help Now