Location: List Archives

List Archives

This forum is an archive of all posts to our mailing list over the past few years.  The forum is set read only therefore to contribute you will need to join our list community.  See more info about this here.

 

When subscribed to the list you should use your standard email client to send your posts to ActiveDir@mail.activedir.org.

List Archives

Subject: RE: [ActiveDir] Need a way to add users to a Distribution list in Exch 2010
Prev Next
You are not authorized to post a reply.

AuthorMessages
robertsingersUser is Offline

Posts:622

08/19/2012 9:48 PM  
As I helpfully informed the list about a month ago :-)

For those pesky Exchange cmdlet which seem to randomly complain add a blank string to every parameter imported to turn any null value to a blank string

e.g.
-Department ($_.department + "") `

________________________________
From: activedir-owner@xxxxxxxxxxxxxxxx [mailto:activedir-owner@xxxxxxxxxxxxxxxx] On Behalf Of Pradeep Rawat
Sent: Monday, August 20, 2012 7:56 AM
To: activedir@xxxxxxxxxxxxxxxx
Subject: Re: [ActiveDir] Need a way to add users to a Distribution list in Exch 2010

The error is there because the parameter value is null when it is assigned. To me it looks like the CSV file problem.
If you run only Import-Csv C:\contacts.csv what output did you see ? Post trimmed output if possible.
I just tested attached CSV format and it works fine for me.

On Mon, Aug 20, 2012 at 12:56 AM, Dan Stanley <dan.stanley@xxxxxxxxxxxxxxxx<mailto:dan.stanley@xxxxxxxxxxxxxxxx>> wrote:
I tried E.g.1


Import-Csv C:\contacts.csv | % {Add-DistributionGroupMember -Identity
"Plan Booklet - list -" -Member $_.Mail}


And I am getting an error " Cannot Validate argument on parameter
'Member' the argument is Null supply a non-null argument and try the
command again"


On 8/19/12, Pradeep Rawat <pradeeprawat85@xxxxxxxxxxxxxxxx<mailto:pradeeprawat85@xxxxxxxxxxxxxxxx>> wrote:
> Try to put the distribution group name in quotes. See the highlighted
> format below.
>
> *E.g.1*
> Import-Csv C:\contacts.csv | % {Add-DistributionGroupMember -Identity
> "*DL-Payroll
> Tool Admins*" -Member $_.Mail}
>
> *E.g.2*
> $contacts = Get-MailContact
> $contacts | %{Add-DistributionGroupMember -Identity "DL-Payroll Tool
> Admins" -Member $_.Alias}
>
>
>
> Thanks,
> - Pradeep Rawat
>
> On Sun, Aug 19, 2012 at 8:21 AM, Dan Stanley <dan.stanley@xxxxxxxxxxxxxxxx<mailto:dan.stanley@xxxxxxxxxxxxxxxx>> wrote:
>
>> Hoping someone can help...
>>
>> I am getting an error in PS trying to add users to a Distribution
>> List from a CSV file on my C drive.
>>
>>
>> Script I am running
>>
>> import-csv c:\contacts.csv | foreach-object {
>> add-distributiongroupmember Plan Booklet - list - | -member $_.mail }
>>
>>
>> Now on the CSV file I only have 1 column with the email addresses.
>>
>>
>>
>> Is it the Format of the CSV I need to change? Please help.
>>
>>
>> I even tried running this in PS and no dice.
>> $contacts=get-Mailcontact
>>
>> $contacts| foreach-object{ Add-DistributionGroupMember -identity "Plan
>> Booklet - list -" -Member $_.Name}
>>
>> Import-CSV C:\Contacts.csv | ForEach {Add-DistributionGroupMember
>> -Identity "Plan Booklet - list -" -Member $_.Name}
>>
>> On 8/17/12, Dan Stanley <dan.stanley@xxxxxxxxxxxxxxxx<mailto:dan.stanley@xxxxxxxxxxxxxxxx>> wrote:
>> > ---------- Forwarded message ----------
>> > From: S. Pidgorny <sl@xxxxxxxxxxxxxxxx<mailto:sl@xxxxxxxxxxxxxxxx>>
>> > Date: Fri, Aug 17, 2012 at 4:33 PM
>> > Subject: Re: [ActiveDir] Need a way to add users to a Distribution list
>> in
>> > Exch 2010
>> > To: activedir@xxxxxxxxxxxxxxxx<mailto:activedir@xxxxxxxxxxxxxxxx>
>> >
>> >
>> > Import-CSV info is at
>> > http://technet.microsoft.com/en-us/library/ee176874.aspx
>> >
>> > Your task could be as easy as "Import-Csv 'file.csv' | % {
>> > Add-ADGroupMember ... }" if you had sAMAccountName in the CSV file. I
>> think
>> > some preprocessing would be required if you have sn and email only
>> > there.
>> >
>> > regards
>> >
>> > Slav
>> >
>> >
>> > On 18/08/2012 9:21 AM, Dan Stanley wrote:
>> >
>> > I have been told this can be done with powershell is that correct? I
>> > have
>> > csv file with the first lastname and their email addresses.. i just
>> > need
>> > help with proper syntax and how to make the columns on the csv file
>> > Any help would be great. Dan
>> >
>>
>> List info: http://www.activedir.org/List.aspx
>>
>

List info: http://www.activedir.org/List.aspx



--
Thanks,
Pradeep Rawat
________________________________

This message has been scanned for viruses and is believed to be clean.

________________________________

---------------------------------------------------------------
Any opinions expressed in this message are not necessarily
those of the Ministry of Business, Innovation and Employment.
This message and any files transmitted with it are confidential
and solely for the use of the intended recipient. If you are
not the intended recipient or the person responsible for
delivery to the intended recipient, be advised that you have
received this message in error and that any use is strictly
prohibited. Please contact the sender and delete the message
and any attachment from your computer.

#####################################################################################
This message has been scanned for viruses and is believed to be clean.
#####################################################################################

You are not authorized to post a reply.
Forums >ActiveDir Mail List Archive >List Archives > RE: [ActiveDir] Need a way to add users to a Distribution list in Exch 2010



ActiveForums 3.7
Friends

Friends

VisualClickButoton
Members

Members

MembershipMembership:
Latest New UserLatest:kmckinney
New TodayNew Today:1
New YesterdayNew Yesterday:3
User CountOverall:5488

People OnlinePeople Online:
VisitorsVisitors:42
MembersMembers:0
TotalTotal:42

Online NowOnline Now:

Ads

Copyright 2012 ActiveDir.org
Terms Of Use