Thanks Joe – I do use adfind a lot for ad hoc stuff, but I haven’t figured out how to use it within scripts yet. The ADO query I’m setting up is part one of a two-part script. Ultimately, what I want to do is find all the RPT* groups, and then place the members of each of them into a spreadsheet, like…

 

Group                   Members

RPT001                 Joe

RPT002                 Guido

RPT002                 Robbie

 

As always, you guys have given me a lot to build upon. Thanks!

 

<mc>

-----Original Message-----
From:
joe [mailto:listmail@joeware.net]
Sent: Sunday, May 02, 2004 10:11 AM
To:
[EMAIL PROTECTED]
Subject: RE: [ActiveDir] help querying for groups

 

Hey Mark,

 

I am not an ADO fan but it appears you are missing the attributes you want returned in your execute...

 

BTW, this will get you ALL groups named RPT* in the domain, it won't just get Global Groups. If you want global groups only, you need to add something to your filter...

 

All Global Groups: (groupType=grouptype:1.2.840.113556.1.4.803:=2)

All Global DLs: (groupType=2)

All Global Security groups: (groupType=-2147483646)

 

See http://msdn.microsoft.com/library/default.asp?url="">  for the group type enumeration...

 

Of course you could always do something like:

 

adfind -bit -b <domain DN> -f "&(objectcategory=group)(groupType=grouptype:AND:=2)(name=RPT*)"

 

or if you just want DNs you could do

 

adfind -bit -b <domain DN> -f "&(objectcategory=group)(groupType=grouptype:AND:=2)(name=RPT*)" -dn

 

 

 

  joe

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Creamer, Mark
Sent: Friday, April 30, 2004 4:31 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] help querying for groups

Hi, can someone help me troubleshoot this script? I’m trying to return all of the global groups in the domain whose name starts with RPT. All I’m getting is the error: “Provider: Unspecified error”

 

strBase = "<LDAP://dc=my,dc=domain,dc=com>;"

strFilter = "(&(objectCategory=group)(name=RPT*));"

strScope = "Subtree"

 

Set objConn = CreateObject("ADODB.Connection")

objConn.Open "Provider=ADsDSOObject"

Set ObjRS = objConn.Execute(strBase & strFilter & strScope)

objRS.MoveFirst

While Not ObjRS.EOF

     WScript.Echo objRS.Fields(0).Value

     objRS.MoveNext

Wend

 

I’m trying to do this by altering one of the recipes in Robbie Allen’s book. Thanks!

 

Mark Creamer

Systems Engineer

Cintas Corporation

Honesty and Integrity in Everything We Do

 

Reply via email to