Please help me with the script below. I'm using it to list all the computers from the Servers OU in a specified domain in Active Directory. Unfortunately, the script (which is a modified version of Listing 5.30 in the Microsoft Windows 2000 Scripting guide) only returns the first 1,000 entries. We have more than 1,000 computers in my enterprise. What do I need to do to retrieve all computers and not just the first 1,000? If I can't retrieve an unlimited number of computers, can I turn some setting up to an obscenely high number like 2,000,000 and accomplish the same goal? All help is appreciated

-raj

--------------------------------------------------------------------------------------------------------------------------------------------

Option Explici

On Error Resume Nex

'************************************
'* Explicitly Defined Variables
'************************************

Dim objConnectio
Dim objComman
Dim objRecordSe
Dim fqd
Dim o

'Establish and initialize connection to Active Directory Databas
Set objConnection = CreateObject("ADODB.Connection"
objConnection.Open "Provider=ADsDSOObject;

Set objCommand = CreateObject("ADODB.Command"
objCommand.ActiveConnection = objConnectio

'Search command passed to active director
objCommand.CommandText =
"<LDAP://ou=Servers,dc=my,dc=domain,dc=net>;(objectCategory=computer)" &
";name,operatingSystem;subtree

Set objRecordSet = objCommand.Execut

While Not objRecordSet.EO
fqdn = objRecordSet.Fields("Name"
os = objRecordSet.Fields("operatingSystem")

Wscript.Echo os & " " & fqd

objRecordSet.MoveNex
Wen

'Close Active Directory Connectio
objConnection.Close

Want more than 1,000 results from AD Query by David

David
Tue May 25 16:13:13 CDT 2004

objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 150
objCommand.Properties("Cache Results") = False

Set objRecordSet = objCommand.Execute

something like that should do the trick!

>-----Original Message-----
>Please help me with the script below. I'm using it to
list all the computers from the Servers OU in a specified
domain in Active Directory. Unfortunately, the script
(which is a modified version of Listing 5.30 in the
Microsoft Windows 2000 Scripting guide) only returns the
first 1,000 entries. We have more than 1,000 computers in
my enterprise. What do I need to do to retrieve all
computers and not just the first 1,000? If I can't
retrieve an unlimited number of computers, can I turn some
setting up to an obscenely high number like 2,000,000 and
accomplish the same goal? All help is appreciated.
>
>-rajl
>
>----------------------------------------------------------
-----------------------------------------------------------
------------------------
>
>Option Explicit
>
>On Error Resume Next
>
>'*************************************
>'* Explicitly Defined
Variables *
>'*************************************
>
>Dim objConnection
>Dim objCommand
>Dim objRecordSet
>Dim fqdn
>Dim os
>
>'Establish and initialize connection to Active Directory
Database
>Set objConnection = CreateObject("ADODB.Connection")
>objConnection.Open "Provider=ADsDSOObject;"
>
>Set objCommand = CreateObject("ADODB.Command")
>objCommand.ActiveConnection = objConnection
>
>'Search command passed to active directory
>objCommand.CommandText = _
> "<LDAP://ou=Servers,dc=my,dc=domain,dc=net>;
(objectCategory=computer)" & _
> ";name,operatingSystem;subtree"
>
>Set objRecordSet = objCommand.Execute
>
>While Not objRecordSet.EOF
> fqdn = objRecordSet.Fields("Name")
> os = objRecordSet.Fields("operatingSystem")
>
> Wscript.Echo os & " " & fqdn
>
> objRecordSet.MoveNext
>Wend
>
>'Close Active Directory Connection
>objConnection.Close
>.
>

Re: Want more than 1,000 results from AD Query by Philip

Philip
Tue May 25 17:46:05 CDT 2004

Try this vbs script.

Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://OU=server,DC=my,DC=domain,DC=net' "
_
& "where objectClass='computer'"
objCommand.Properties("Page Size") = 5000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
Wscript.Echo "Location: " & objRecordSet.Fields("Location").Value
objRecordSet.MoveNext
Loop


Hope it helps a bit.

Phil

"rajl" <anonymous@discussions.microsoft.com> wrote in message
news:6ABAFB73-F527-4DF3-BF11-B0F32C31A9C5@microsoft.com...
> Please help me with the script below. I'm using it to list all the
computers from the Servers OU in a specified domain in Active Directory.
Unfortunately, the script (which is a modified version of Listing 5.30 in
the Microsoft Windows 2000 Scripting guide) only returns the first 1,000
entries. We have more than 1,000 computers in my enterprise. What do I
need to do to retrieve all computers and not just the first 1,000? If I
can't retrieve an unlimited number of computers, can I turn some setting up
to an obscenely high number like 2,000,000 and accomplish the same goal?
All help is appreciated.
>
> -rajl
>
> --------------------------------------------------------------------------
-------------------------------------------------------------------
>
> Option Explicit
>
> On Error Resume Next
>
> '*************************************
> '* Explicitly Defined Variables *
> '*************************************
>
> Dim objConnection
> Dim objCommand
> Dim objRecordSet
> Dim fqdn
> Dim os
>
> 'Establish and initialize connection to Active Directory Database
> Set objConnection = CreateObject("ADODB.Connection")
> objConnection.Open "Provider=ADsDSOObject;"
>
> Set objCommand = CreateObject("ADODB.Command")
> objCommand.ActiveConnection = objConnection
>
> 'Search command passed to active directory
> objCommand.CommandText = _
> "<LDAP://ou=Servers,dc=my,dc=domain,dc=net>;(objectCategory=computer)" & _
> ";name,operatingSystem;subtree"
>
> Set objRecordSet = objCommand.Execute
>
> While Not objRecordSet.EOF
> fqdn = objRecordSet.Fields("Name")
> os = objRecordSet.Fields("operatingSystem")
>
> Wscript.Echo os & " " & fqdn
>
> objRecordSet.MoveNext
> Wend
>
> 'Close Active Directory Connection
> objConnection.Close



Re: Want more than 1,000 results from AD Query by Roger

Roger
Tue May 25 19:30:35 CDT 2004

There is a resultset size threshold on queries set at the
domain level. You can view and change this with
ntdsutil

--
Roger Abell
Microsoft MVP (Windows Server System: Security)
MCSE (W2k3,W2k,Nt4) MCDBA
"rajl" <anonymous@discussions.microsoft.com> wrote in message
news:6ABAFB73-F527-4DF3-BF11-B0F32C31A9C5@microsoft.com...
> Please help me with the script below. I'm using it to list all the
computers from the Servers OU in a specified domain in Active Directory.
Unfortunately, the script (which is a modified version of Listing 5.30 in
the Microsoft Windows 2000 Scripting guide) only returns the first 1,000
entries. We have more than 1,000 computers in my enterprise. What do I
need to do to retrieve all computers and not just the first 1,000? If I
can't retrieve an unlimited number of computers, can I turn some setting up
to an obscenely high number like 2,000,000 and accomplish the same goal?
All help is appreciated.
>
> -rajl
>
> --------------------------------------------------------------------------
-------------------------------------------------------------------
>
> Option Explicit
>
> On Error Resume Next
>
> '*************************************
> '* Explicitly Defined Variables *
> '*************************************
>
> Dim objConnection
> Dim objCommand
> Dim objRecordSet
> Dim fqdn
> Dim os
>
> 'Establish and initialize connection to Active Directory Database
> Set objConnection = CreateObject("ADODB.Connection")
> objConnection.Open "Provider=ADsDSOObject;"
>
> Set objCommand = CreateObject("ADODB.Command")
> objCommand.ActiveConnection = objConnection
>
> 'Search command passed to active directory
> objCommand.CommandText = _
> "<LDAP://ou=Servers,dc=my,dc=domain,dc=net>;(objectCategory=computer)" & _
> ";name,operatingSystem;subtree"
>
> Set objRecordSet = objCommand.Execute
>
> While Not objRecordSet.EOF
> fqdn = objRecordSet.Fields("Name")
> os = objRecordSet.Fields("operatingSystem")
>
> Wscript.Echo os & " " & fqdn
>
> objRecordSet.MoveNext
> Wend
>
> 'Close Active Directory Connection
> objConnection.Close



Re: Want more than 1,000 results from AD Query by anonymous

anonymous
Wed May 26 08:06:04 CDT 2004

How would I use ntdsutil to change the threshhold?