?
Solved

add a member to DL in exchange

Posted on 2014-07-23
13
Medium Priority
?
282 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
Need protection from advanced malware attacks?

Look no further than WatchGuard's Total Security Suite, providing defense in depth against today's most headlining attacks like Petya 2.0 and WannaCry. Keep your organization out of the news with protection from known and unknown threats.

 
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 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
To show how to generate a certificate request 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 Servers >> Certificates…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

770 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