Solved

Import all the users in specific OU To Distribution list

Posted on 2016-07-24
6
52 Views
Last Modified: 2016-08-22
Hi Guy,


I wonder if there is any way I can do the following

I have an OU called test which have about 1500 users I need to add them to DL every time someone created a New users in this Test OU .

Note : this OU has a Sub Tree OU’s as well

Thank you in advance and appreciate your Quick response
0
Comment
Question by:Rabihhaj
6 Comments
 
LVL 8

Accepted Solution

by:
Antzs earned 250 total points (awarded by participants)
ID: 41726892
I would assume you are using Exchange.  In Exchange you can use Dynamic Distribution Group(DDG) to achieve this.  When creating the DDG, you will be able to set the rule to include users from specific OUs.

So the next time anyone add a user in the OU it will be included into the DDG.
0
 
LVL 40

Assisted Solution

by:Adam Brown
Adam Brown earned 125 total points (awarded by participants)
ID: 41726991
Dynamic Distribution Group is the way to go on this one, but be aware that with 1500 users there will probably be a noticeable delay in mail delivery when sending to the group, since DDGs have to determine membership at time of delivery for each message sent.

If that delay is not acceptable, it's possible to add all of the users in an OU to a specific group by using the -organizationalunit switch of the get-mailbox cmdlet, then piping that to add-distributiongroupmember, like this:

get-mailbox -organizationalunit <OU Name> | add-distributiongroupmember <Distribution group name

Open in new window

1
 
LVL 8

Expert Comment

by:Antzs
ID: 41727005
The delay would probably be minimum depending on the Exchange performance.  I have a DDG which adds about 1000 users and I dont see any delay.

But if using the -organizationalunit switch, the Exchange PowerShell Script would probably need to be run on a schedule so that new users created in the OU will continue to be added into the group.
1
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 9

Assisted Solution

by:dipersp
dipersp earned 125 total points (awarded by participants)
ID: 41727509
I'm also assuming Exchange.

Anything we can automate when it comes to "every user" or every user in an OU, use Exchange CmdletExtensionAgent (If Exchange 2010+).  This is basically a powershell script that runs every time a user action is performed, such as a new mailbox.  

There is a file named ScriptingAgentConfig.xml.sample that is located under C:\Program Files\Microsoft\Exchange Server\V14\Bin\CmdletExtensionAgents.  Remove the .SAMPLE extension and then edit the file to do what you want.  Lots of examples online.  Here's one we use for adding every user to a retention policy when we create a mailbox -

<?xml version="1.0" encoding="utf-8" ?>
<Configuration version="1.0">
    <Feature Name="MailboxProvisioning" Cmdlets="new-mailbox,enable-mailbox">
 
         <ApiCall Name="OnComplete">
              if($succeeded) {
                Set-Mailbox $provisioningHandler.UserSpecifiedParameters["Alias"] -RetentionPolicy "_EnerTech Default Retention Policy"
               }
         </ApiCall>
     </Feature>
</Configuration>

Open in new window


Once you have the file doing what you want (You'll want to add in an IF to check the OU), then you enable the agent by entering the following in PS -

Enable-CmdletExtensionAgent "Scripting Agent"

Also if you have more than one Exchange box, make sure to copy the XML to all boxes.
1
 

Author Comment

by:Rabihhaj
ID: 41733812
all comments are helpful
0
 
LVL 40

Expert Comment

by:Adam Brown
ID: 41757588
Asker suggested that all the comments were helpful, but did not grade.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

733 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