Re: Adding a group to multiple Distribution list
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 30 May 2009 12:26:23 -0500
"Amarnath" <Amarnath @discussions.microsoft.com> wrote in message
news:BD2EB60C-BF9D-45E2-92C2-EA68DC71C05F@xxxxxxxxxxxxxxxx
I just wanted to know, how to add a single group to multiple distribution
list (appr 150 lists).
and members those are in single group needs to manage all the 150
distribution lists (i.e they should be owner of the distribution list).
Help is really appreciated.
The "owner" of an object is specified in the security descriptor of the
object. But distribution lists do not have security descriptors, so they
cannot have an "owner". There is a managedBy attribute, which specifies the
user or contact that manages the group. However, this must be the
Distinguished Name of a user or contact. It cannot be a group. Exchange may
have some other mechanism for what you want.
To add a single group to multiple distribution groups, you must specify the
Distinguished Name of the group (of any kind) to be added as a member. Also,
you need a list of the Distinguished Names of the distribution groups,
perhaps in a text file. A VBScript solution would be similar to below:
===========
Option Explicit
Dim strGroupList, strNewMember, objNewMember, objGroup
Dim objFSO, objList, strGroup
Const ForReading = 1
' Specify Distinguished Name of new member (group or user).
strNewMember = "cn=MyList,ou=West,dc=MyDomain,dc=com:"
' Specify list of distribute group Distinguished Names.
strGroupList = "c:\Scripts\groups.txt"
' Bind to the new member object.
Set objNewMember = GetObject("LDAP://" & strNewMember)
' Open the file of group names for read access.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objList = objFSO.OpenTextFile(strGroupList, ForReading)
' Read the list of Distinguished Names.
Do Until objList.AtEndOfStream
strGroup = Trim(objList.ReadLine)
' Skip blank lines.
If (strGroup <> "") Then
' Bind to the Distribution Group.
' Trap error if group not found.
On Error Resume Next
Set objGroup = GetObject("LDAP://" & strGroup)
If (Err.Number <> 0) Then
On Error GoTo 0
' Check if specified group already a member
' of this distribution group.
If (objGroup.IsMember(objNewMember.AdsPath) = False) Then
' Not a member, add to group.
objGroup.Add(objNewMember.AdsPath)
End If
Else
On Error GoTo 0
Wscript.Echo strGroup & " not found"
End If
End If
Loop
' Clean up.
objList.Close
=======
This can still be done if the list of distribution group names is the
"pre-Windows 2000 logon" names, but the script would require a few more
steps. You would use the NameTranslate object to convert the "pre-Windows
2000" names into Distinguished Names. You could also code a VBScript program
to spit out the Distinguished Names of all Distribution groups in the domain
(or in an OU) and echo the output to a text file to create the list. That
script would use ADO to retrieve the names. For information on using
NameTranslate in VBScript see this link:
http://www.rlmueller.net/NameTranslateFAQ.htm
For information on using ADO in VBScript see this link:
http://www.rlmueller.net/ADOSearchTips.htm
Using the syntax from this last link, the filter for all distribution groups
would be:
strFilter = "(&(objectCategory=group)" _
& "(!groupType:1.2.840.113556.1.4.803:=2147483648))"
That is also the filter that would be used in any command line utilities to
retrieve Distinguished Names, like dsquery or adfind.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
.
- Prev by Date: Re: Recover Windows Server 2003 DC that won't boot but drive can be read
- Next by Date: Re: Problems with W2K3 Standard DC - Replication and DNS
- Previous by thread: Re: Reporting tool for Active Directory
- Next by thread: Re: MMC 40000015
- Index(es):
Relevant Pages
|
Loading