Solved

add a member to DL in exchange

Posted on 2014-07-23
13
267 Views
Last Modified: 2014-08-09
Hi,

I have a user that I need to make adminisitrator of about 100 Distrubition groups in Exchange 2010 enviroment. Can you please give a powershell script to that for more than 100 DL.
0
Comment
Question by:kuzum
  • 8
  • 4
13 Comments
 
LVL 7

Expert Comment

by:Murali Reddy
ID: 40214988
Get the list of all the DLs of interest and make a CSV file containing the say PrimarySmtpAddress as a column (can be only column). Let us say you save it as "C:\DLCSVfile.csv"

Add-PSSnapin *Exchange*

$temp= Import-Csv "C:\DLCSVfile.csv"
foreach ($i in $temp)
{
Get-DistributionGroup $i.PrimarySmtpAddress |Set-DistributionGroup -ManagedBy "OwnerName"
}
0
 

Author Comment

by:kuzum
ID: 40217694
thanks, I will try this, What did you mean by $i.PrimarySmtpAddress ?
0
 

Author Comment

by:kuzum
ID: 40217701
I only have the names, getting smtp addresses will be a long process. will that not work?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40220383
Try..
GC C:\group.txt | %{
Set-DistributionGroup -Identity $_ -ManagedBy "subsun"
}

Open in new window

Input the group names in C:\group.txt
Example..
GroupA
GroupB
GroupC

Open in new window

0
 

Author Comment

by:kuzum
ID: 40249763
Subsun, it did not work I'm afraid.

Error is

The term 'Set-DistributionGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. "

Where am I going wrong?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40250092
You need to run the script from Exchange Management Shell..
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:kuzum
ID: 40250259
I saved the script as dl.ps1 on exchange server and run it as .\dl.ps1 and this is the error I received

Add-PSSnapin : The Windows PowerShell snap-in 'Exchange' is not installed on this machine.
0
 

Author Comment

by:kuzum
ID: 40250274
Hi Subsun,
I managed to run the script in exchange shell and this is the error I received

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type "Microsoft.Exchange.Con
figuration.Tasks.DistributionGroupIdParameter". Error: "Parameter values of type Microsoft.Exchange.Configuration.Tasks
.DistributionGroupIdParameter can't be empty. Specify a value, and try again.
Parameter name: identity"
    + CategoryInfo          : InvalidData: (:) [Set-DistributionGroup], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-DistributionGroup
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40250700
probably your input text file have empty lines..
Try...
GC C:\group.txt | ?{$_}|%{
Set-DistributionGroup -Identity $_ -ManagedBy "subsun"
}

Open in new window

0
 

Author Comment

by:kuzum
ID: 40251166
Excellent Subsun, it worked fine.

If I would like to add more users to admin group, can you please also send me amended script so i can use?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40251189
That was not the original requirement.. In future please open a new question for additional requirements... :-)

To make more users admin, you need to add the users to ManagedBy parameter for example..
Set-DistributionGroup -Identity $_ -ManagedBy "subsun","subsun1","subsun2

Open in new window

"
0
 

Author Comment

by:kuzum
ID: 40251194
ok, please keep an eye on my new request:)
0
 

Author Comment

by:kuzum
ID: 40251216
please comment on my new post
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Read this checklist to learn more about the 15 things you should never include in an email signature.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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 …

919 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