dsquery * domainroot -filter
"(&(objectcategory=group)(!sAMAccountType:1.2.840.113556.1.4.803:=1))"
Would return security groups regardless if they are also DG's. 

What might be easier is to use a filter that looks for legacyExchangeDN
which must exist in order for it to be an Exchange object.  In this case a
DG.  Proxyaddresses would also work in place of legacyExchangeDN.  The
syntax might look something like

 dsquery * domainroot -filter
"(&(objectCategory=group)(legacyExchangeDN=*))" which will give you all
groups that are Exchange mail-enabled, regardless of security group or not
and regardless of location in the forest (I'm guessing about the forest
location as I'm not that familiar with dsquery to know if it will query the
GC or the DC in this case.  If it queries the DC you may not get all of the
groups. Should be easy to double check though). 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/ad
schema/attributes_anr.asp?frame=true Will give you a list of other
attributes that might be of interest.

Al

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Johnson
Sent: Wednesday, November 03, 2004 9:13 AM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] Scripting help

Thanks Dean. Would that return the Security groups that are also being used
as DL by virtue of having the proxy address field set? 

 

Sorry if it's an obvious question but I new to this side of AD

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dean Wells
Sent: 03 November 2004 16:11
To: Send - AD mailing list
Subject: RE: [ActiveDir] Scripting help

 

Here's but two possible ways that sprung to mind.

 

Returns security groups only -

 

dsquery * domainroot -filter
"(&(objectcategory=group)(!sAMAccountType:1.2.840.113556.1.4.803:=1))"

 

Return DLs only -

 

dsquery * domainroot -filter
"(&(objectcategory=group)(sAMAccountType:1.2.840.113556.1.4.803:=1))"

 

Deano

--
Dean Wells
MSEtechnology
* Email: [EMAIL PROTECTED]
http://msetechnology.com <http://msetechnology.com/>  

 

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Johnson
Sent: Wednesday, November 03, 2004 3:55 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] Scripting help

Hi to all from Darkest Africa!!

 

Can anyone assist me with a scripting issue?

 

 I've generated a list of the groups in my AD by using dsquery. I have a
text file as output. I've been able read this into a file and extract some
information. However my management wants a list of all the Distribution
lists only with the Name of the Group and who it's Manager is. 

 

My script generates all the requisite info but I can't get it to
differentiate between Security and DL's. We have a bunch of Security Groups
that have had Exchange E-mail addresses added to them and so are being used
as DL's as well. It appears that all the DL's have a proxyAddresses
attribute. 

 

Is there anyway I can do a script based search through the whole if the
domain and extract all groups that have this attribute and return the values
that I need.

 

Any help would really appreciated as I'm completely new to this.

 

Regards

Peter Johnson

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to