Hi Ulf, The code below works for me (please note the placement of "<" and ">"): ==snip== Set oRootDSE = GetObject("LDAP://RootDSE") varDomainNC = oRootDSE.Get("defaultNamingContext") oConnection.Provider = "ADsDSOObject" oConnection.Open "ADs Provider" strQuery = "<LDAP://" & varDomainNC & ">;(&(objectCategory=group)(sAMAccountName=Do*));adspath;subtree" oCommand.ActiveConnection = oConnection oCommand.CommandText = strQuery Set RS = oCommand.Execute ==snip== Unfortunately I did not have the chance to test the code with the ">" moved to the end of the statement. Hi Mark, I did not read all details in your posting. As you wanted only Global groups the code posted by Richard will probably give you the result you are looking for. If you are more into troubleshooting your own code, changing .Provider and .Open as below perhaps can help you? objConn.Provider = "ADsDSOObject" objConn.Open "ADs Provider" ' objConn.Open "Active Directory Provider" should also be possible (not tested)
Regards, /MS ________________________________ From: [EMAIL PROTECTED] on behalf of Ulf B. Simon-Weidner Sent: Fri 2004-04-30 23:57 To: [EMAIL PROTECTED] Subject: AW: [ActiveDir] help querying for groups Hi Mark, first thing which comes to my eyes is that the base it not started and ended with "<" and ">", but the whole query including base, filter and scope is. So what I'd try is modifying the line beginning with strBase with strBase = "LDAP://dc=my,dc=domain,dc=com;" and the line starting with set objRS with Set ObjRS = objConn.Execute("<" & strBase & strFilter & strScope & ">") HTH, Ulf ________________________________ Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Creamer, Mark Gesendet: Freitag, 30. April 2004 22:31 An: [EMAIL PROTECTED] Betreff: [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
<<winmail.dat>>