cawasaki
asked on
powershell script to create bulk distribution list on exchange 2013
hello,
i need a powershell script to create bulk distribution list on exchange 2013, the DL must be created in specific OU in Active Directory
i have a csv entry file like this:
DisplayName,Name,Email,Des cription
@DL_Neywork,DL_Neywork,DL_ Neywork@co ntoso.com, "distribut ion list of new yor people"
........
a distribution list may already exist on the list, so i need to have a log file say:
dl_newyor created succesfully
or
dl_newyor created already exist
.....
thnaks for help
i need a powershell script to create bulk distribution list on exchange 2013, the DL must be created in specific OU in Active Directory
i have a csv entry file like this:
DisplayName,Name,Email,Des
@DL_Neywork,DL_Neywork,DL_
........
a distribution list may already exist on the list, so i need to have a log file say:
dl_newyor created succesfully
or
dl_newyor created already exist
.....
thnaks for help
ASKER
hello,
distribution list must be not security group so they can not be used to attribute any ntfs right or other and will be easily deleted in the future
possible?
and the csv file must be like this one because already exist:
DisplayName,Name,Email,Des cription
@DL_Neywork,DL_Neywork,DL_ Neywork@co ntoso.com, "distribut ion list of new yor people"
.....
thanks
distribution list must be not security group so they can not be used to attribute any ntfs right or other and will be easily deleted in the future
possible?
and the csv file must be like this one because already exist:
DisplayName,Name,Email,Des
@DL_Neywork,DL_Neywork,DL_
.....
thanks
Hey,
Incase, if you don't want these distribution list to be security group. You can change the Type to " Distribution"
Yes, it will be easily deleted in future.
I didn't got the last one where you say Distribution list already exist.
Incase, if you don't want these distribution list to be security group. You can change the Type to " Distribution"
Yes, it will be easily deleted in future.
I didn't got the last one where you say Distribution list already exist.
ASKER
@rohit Anand
your sript does not do all what i want,
the csv file is like this:
DisplayName,Name,Email,Des cription
@DL_Neywork,DL_Neywork,DL_ Neywork@co ntoso.com, "distribut ion list of new yor people"
........
so the script must create Distribution list on specific OU and set the description
thanks for help
your sript does not do all what i want,
the csv file is like this:
DisplayName,Name,Email,Des
@DL_Neywork,DL_Neywork,DL_
........
so the script must create Distribution list on specific OU and set the description
thanks for help
Hey, What I understand that you wanted to have script which will create a bulk DL, in a specific OU, Email Address, and Description.. Do let me know, in case I am wrong
ASKER
yes but your script code not do all what i ask and specially not take my csv input?
Yes, it will not take.
Can you please let me know few more details,
Do you want to keep common description for each DL?
Can you please let me know few more details,
Do you want to keep common description for each DL?
cawasaki,
This is pretty straight forward.
Import-Csv "enterfilepathofyourcsvfil e" | %{New-DistributionGroup -Name $_.Name -DisplayName $_.DisplayName -PrimarySmtpAddress $_.Email -Type Distribution -Notes $_.Description -MemberDepartRestriction Closed -MemberJoinRestriction Closed -verbose}
This is pretty straight forward.
Import-Csv "enterfilepathofyourcsvfil
You may also capitalize on your .csv by adding a column ManagedBy and list the owners you would like of the dl by email address
Example:
DisplayName,Name,Email,Des cription,M anagedby
@DL_Neywork,DL_Neywork,DL_ Neywork@co ntoso.com, "distribut ion list of new yor people",JDoe@yourdomain.co m
the script would now read
Import-Csv "enterfilepathofyourcsvfil e" | %{New-DistributionGroup -Name $_.Name -DisplayName $_.DisplayName -PrimarySmtpAddress $_.Email -Type Distribution -Notes $_.Description -managedby JDoe@yourdomain.com -MemberDepartRestriction Closed -MemberJoinRestriction Closed -verbose}
Example:
DisplayName,Name,Email,Des
@DL_Neywork,DL_Neywork,DL_
the script would now read
Import-Csv "enterfilepathofyourcsvfil
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use below script to create bulk distribution list in Exchange Server
Create a CSV File, and give the heading of the first column header as DisplayName and keep all distribution list name in that column.
You can check out attach CSV file for help.
Once you will save it, Execute below commands
$a = import-csv "Give the CSV file path"
$a | foreach-object{New-Distrib
Do execute it, and let me know, in case if you face any issue.
DLCreationCSVFormat.csv