Link to home
Start Free TrialLog in
Avatar of prashantgore
prashantgore

asked on

How to Create Bulk Distribution List in Exchange 2007

How to Create Bulk Distribution List in Exchange 2007 & also add multiple member.
Avatar of Hilal1924
Hilal1924
Flag of India image

Use the Powershell command with the required parametrs:
New-DistributionList
 
Or you can go to
Exchange Manaagement Console => Recipient Configuration =>Groups
From there you can create Distribution Groups.
 http://technet.microsoft.com/en-us/library/bb125256(EXCHG.80).aspx
More Info:
http://myitforum.com/cs2/blogs/yli628/archive/2008/05/12/powershell-cmdlets-to-work-with-distribution-group-in-exchange-2007-becareful-the-difference-between-ad-and-exchange.aspx
For Dynamic Distribution Group
http://www.exchangeninjas.com/DG4ServerUsers 
Hilal
Avatar of prashantgore
prashantgore

ASKER

I Want Bulk DistributionGroup Creation
I have 1500 Distribution Group to be created in Exchange 2007 in one shot.

Can be like import from *.CSV file
Sure you can. Here is how:

Scenario: Bulk create mailboxes based on a CSV file
Shell one-liner: The following one-liner creates mailboxes for all team members listed in an Avalanche.csv file, which contains NHL Avalanche team roster information with the following column format:

    Pos,No,Player,Age,Ht,Wt,Born,Exp,Birth City

$password = Read-Host "Enter password" -AsSecureString
import-csv Avalanche.csv | foreach {new-mailbox -alias "avalanche$($_.No)" -Name $_.Player -password $password -database "Mailbox Database" -org Users -UserPrincipalName "avalanche$($_.No)@example.com"}  
More Info:
http://technet.microsoft.com/en-us/library/bb310752(EXCHG.80).aspx 
 
Hilal

$password = Read-Host "Enter password" -AsSecureString
import-csv Avalanche.csv | foreach {new-mailbox -alias "avalanche$($_.No)" -Name $_.Player -password $password -database "Mailbox Database" -org Users -UserPrincipalName "avalanche$($_.No)@example.com"}

Open in new window

Please Disregard the Above Script. I am really sorry for the overlook, it is for creating bulk mailboxes. Though the Technet Article will work fine.
Please use this script instead:

#Adds members to specific Distribution Group
$Member =Import-CSV "C:\Members.csv"
$Member | ForEach-Object -Process {Add-distributiongroupmember $_.DG -member $_.member }
 
I again apologize for the overlook.
Hilal
Dear Hilal1924

We are talking about Bulk DistributionGroup Creation.
I dont want to create Bulk mailboxes.
Dear Hilal1924

You are again Wrong
We are talking about Bulk DistributionGroup Creation. Not Members

1. I need to create 1500 DistributionGroup then I will add member.

So send me a script which creates Bulk DistributionGroup.


ASKER CERTIFIED SOLUTION
Avatar of Hilal1924
Hilal1924
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am again sorry for the overlook. I thought you needed to add memebers to a DL. Anyway Here is a link that will help you achieve your goal:
http://cs.mseducommunity.com/blogs/liveatedu_community_blog/archive/2009/03/22/create-a-bunch-of-standard-distribution-groups-from-a-csv-file.aspx
 I have attached the code as well.
Hilal

$records = import-csv -Path c:\groups.csv -OutVariable string
foreach ($group in $records)
{
    $this_name                 = $group.name
    $this_alias                   = $group.alias
    $this_displayname       = $group.displayname
    $this_type                   = $group.type 

# create distribution group - assigning result to variable to avoid listing the new object
%{Invoke-Command -Session $Session1 {param ($this_name,$this_alias,$this_displayname,$this_type) New-DistributionGroup -Name $this_name -Alias $this_alias -DisplayName $this_displayname -Type $this_type}-arg $this_name,$this_alias,$this_displayname,$this_type} > $results 

}

Open in new window

Dear Hilal

Above mentioned script not working
Do you I need to put any heading in CSV file.

Can you specify data format to be entered in CSV file can you send sample CSV attachment.
Please see the attachment for error i get.
DL.jpg
Hi Hilal

you mean to say thisname , this_alias etc.
Are headings for csv file.

Bit confisued
You CSV File should have headings like this
Name     Alias       DisplayName          Type
 
Hilal
 
Here it is listed better
Name,Alias,DisplayName,Type                          >> These are the headings
Chess,Chess,Chess Club,Security
Computer,Computer,Computer Club,Security
Hi

Getting attached while running above mentioned command
Please see the attachment
dlerror.jpg
Hi Upgrade to PowerShell v2. And you will not get this error. Also, Save the script as DistributionGroup.ps1 and then execute it.
 
Hilal
hi
I have updated the powershell ver2
But still the same error .
Can you tell me In *.csv what should be the format

Eg :- DistributionGroup  Members

Are above mentiond heading for CSV file proper
Hi Can you use the below Script
Import-CSV dg.csv | foreach {new-distributiongroup -name $_.name -samaccountname $_.SAM -type distribution -org Users}

Your CSV File should look like this:

Name,Sam    ====> Keep this heading
Test1,Test1
Test2,Test2
 
Else post the heading of your csv file and I will buidl a script for you.
Hilal
I got the format as mentioned below

Eg:-  DG          Members
      System     Prashant

Now I need to add the owner of the group how to do that ?
"I need to create 1500 DistributionGroup then I will add member." this is from your comment above.
So you wanted to create blank distribution groups from a CSV file.
hey it would really help if you can post the entire heading in comma separated values. Because to import the CSV file, Fields will be matched with attributes of a Distribution Group. The minimum requirements for a Distribution group are Alias, Name, Group Type. So you need to have at least three of these properties in your CSV file. (Group Type is Optional but It will be difficult for you to change the group type later on)
If this how your csv file looks like, DG,Members (btw You should not keep members in a heading). I can Import Distribution Group, Its Name will be whatever is under DG heading and SamAccountName (alias) will be whatever is under members heading.
Import-CSV dg.csv | foreach {new-distributiongroup -name $_.DG -samaccountname $_.Members -type distribution -org Users}
To add an owner to a Distribution Group, Just use this command
Get-DistributionGroup | Set-DistributionGroup -ManagedBy "user" ( Use this if you want to Make a user owner of all Distribution Groups)
Set-DistributionGroup -Identity "Name of DistributionGroup" -ManagedBy "user" (Use this to make a user owner of a single group.
Hilal
Thanks but I need to add DG Owner in Bulk
Again does it have any command with csv file
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Hilal

Thanks for your help
Can you give me a scrip to create bulk Mail Enable Distribution Group.
Please mention the CSV heading format.
can any body reply for above problem
Hi Hilal

Thanks for the help provided but if you can give scrip for below mention problem. I would really appreciate you.

Thanks Again
Hi Hilal

Thanks for the help provided but if you can give scrip for below mention problem. I would really appreciate you.

Can you give me a scrip to create bulk Mail Enable Distribution Group.
Please mention the CSV heading format.

Thanks Again
Prashant,
I have given all the necessary scripts to create Bulk Distribution Group and it is unfortunate that ytou were not able to leverage the script usage. I think I have provided you the solution many times over and hence this question needs to be graded.
Hilal
"The Script provided was working fine and really helped me lot"
The above reason should justify the objection and if you go through the chronology of the events, I have provided him solution many times.
Hilal