Solved

add a member to DL in exchange

Posted on 2014-07-23
13
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 
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
 

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

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…
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
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…

740 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