Solved

add a member to DL in exchange

Posted on 2014-07-23
13
271 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
Is Your AD Toolbox Looking More Like a Toybox?

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.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
In this video we show how to create a mailbox database 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 >> Data…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

825 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