Solved

add a member to DL in exchange

Posted on 2014-07-23
13
264 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
Comment Utility
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
Comment Utility
thanks, I will try this, What did you mean by $i.PrimarySmtpAddress ?
0
 

Author Comment

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

Expert Comment

by:Subsun
Comment Utility
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
Comment Utility
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
Comment Utility
You need to run the script from Exchange Management Shell..
0
Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

 

Author Comment

by:kuzum
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
ok, please keep an eye on my new request:)
0
 

Author Comment

by:kuzum
Comment Utility
please comment on my new post
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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
how to add IIS SMTP to handle application/Scanner relays into office 365.

772 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

15 Experts available now in Live!

Get 1:1 Help Now