Re: Not enough storage is available to process this command

Tech-Archive recommends: Fix windows errors by optimizing your registry



You don't indicate which is line 125. However, it might help to specify some
properties of the ADO Command object. I would try:

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

Insert these before you run the Execute method. Also, the member attribute
is multi-valued and ADO will only return 1500 values (1000 in Windows 2000
AD). This will not raise an error, but if any groups have more members you
will need to use Range Limits to overcome the limiation.

Another issue is that you bind to each group object. This negates the
advantages of ADO and slows the program considerably. The program is a bit
complex to analyze in detail, but it looks like you use the object reference
objGroup to retrieve the values of the attributes sAMAccountName, groupType,
description, and managedBy. All of these attributes could be added to the
comma delimited list of attribute values to retrieve, so there would be no
need to bind to each group object. For example:

objCommand.CommandText = _
"<" & strADPath & ">" & ";(&(objectCategory=group)(mail=*))" _
&
";distinguishedName,member,sAMAccountName,groupType,description,managedBy;subtree"

I used (objectCategory=group) because objectCategory is indexed (objectClass
is not) so the filter will be more efficient. The only caution is the
description attribute is multi-valued (although there is never more than one
value) so that ADO returns an array (similar to member) you need to loop
through (and the array is Null if there is no value).

I see you also bind to the manager object if managedBy has a value. It's
probably not worth it, but if a lot of groups have managers (especially the
same manager) the program would be more efficient if you kept track of
managers in a dictionary object, again to reduce the number of AD objects
that are bound. By far the biggest impact on performance is the number of AD
objects that a program binds to over the network. That's why programs that
use ADO are so much faster - all the work is done on the server and the
client gets one recordset.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"Chris" <Chris@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C32033D-54D2-4BD1-9A91-AE1D93D9DB04@xxxxxxxxxxxxxxxx
Here is the code. I got it from others and made change to the output
format.
It works but stopped with that error at certain point. The exact error is
in my original posting. Thanks.

'==================================================================================================
'
' VBScript Source File
'
' NAME: ListDistGroups.VBS
' AUTHOR: Bharat Suneja ,
' DATE : 8/02/2004
' MODIFIED FOR GENERAL USE - 2/13/2006
' MODIFIED FOR FILE OUTPUT - 3/19/2006
'==================================================================================================
' COMMENT:
'
'
' Lists all groups in a domain
' Shows whether group is Dist. Group or Security Group
' Outputs members of group
'
'==================================================================================================
' updated 3/19/2007: Added option to suppress console output, provide a
file path for file output, and /HELP option
'==================================================================================================


'BANNER INFO
Wscript.Echo "This script lists all groups in the domain"
Wscript.Echo "Format: Group Name, Group Type, Members"
Wscript.Echo "Report Generated at : " & Now & VbCrLf
strOutput = strOutput & VbCrLf & "Report Generated at : " & Now & VbCrLf

'Pickup Named Arguments
Set colNamedArguments = WScript.Arguments.Named
strOutputFile = colNamedArguments.Item("f")
strNoConOutput = colNamedArguments.Item("s")
strHelp = colNamedArguments.Item("help")

'Detect help and write help text to console
WriteHelp

'Get RootDSE
Set objRootDSE = GetObject("LDAP://rootDSE";)
strDomain = objRootDSE.Get("defaultNamingContext")
strADPath = "LDAP://"; & strDomain
Set objDomain = GetObject(strADPath)
wscript.echo "Domain: " & objDomain.distinguishedName




'Setup ADODB connection
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

'Execute search command to look for user
objCommand.CommandText = _
"<" & strADPath & ">" & ";(&(objectClass=group)(mail=*))" &
";distinguishedName,member;subtree"
Set objRecordSet = objCommand.Execute

Wscript.Echo "DISTRIBUTION GROUPS FOUND: " & objRecordSet.RecordCount &
VbCrlf
Wscript.Echo
"--------------------------------------------------------------------------------------------"
& VbCrlf & VbCrlf
I = 0

While Not objRecordSet.EOF 'Iterate through the search results
I = I + 1
strGroupDN = objRecordSet.Fields("distinguishedName")
set objGroup= GetObject("LDAP://"&; strGroupDN & "")

strFirstLine = ""
strFirstLine = strFirstLIne & I & "#" & objGroup.sAMAccountName
& " # "
If objGroup.GroupType = 2 Then
'strFirstLine = strFirstLIne & "Security Group" & "#"
'Else
strFirstLine = strFirstLIne & "Distribution Group" & "#"
End If

strDescription = objGroup.description
strFirstLine = strFirstLine & strDescription & "#"

'Get manager's name
If objGroup.managedBy = "" Then
'Wscript.Echo "This group does not have a Manager."
strFirstLine = strFirstLine & "No Manager" & "#" & VbCrlf

Else
strManagerDN = objGroup.managedBy
set objManager = GetObject("LDAP://"&; strManagerDN & "")
strManagerName = objManager.displayName
strFirstLine = strFirstLine & strManagerName & "#" &
VbCrlf
End If


'strWhenCreated = objRecordSet.Fields("whenCreated")
_
'Shows when the account was created, disable if not
required


'Group operation: Gets group memberships, checks if
Distribution Group, deletes if Distribution Group
If IsNull (objRecordSet.Fields("member")) Then 'Checks
if the user has already been removed from all groups
strFirstLine = strFirstLIne & "---NONE---"
Else
'strFirstLine = strFirstLIne & VbCrlf & "Members: "



For each varUser in objRecordSet.Fields("member").Value

Set objUser = GetObject("LDAP://"; & varUser)

'Wscript.Echo "Group Type= " & objUser.Grouptype

strFirstLine = strFirstLIne &
objUser.displayName
& VbCrlf


Next
End If







'strFirstLine = strFirstLIne & "#"
'Wscript.Echo "-----------------------" & VbCrlf
Wscript.Echo strFirstLine
strOutput = strOutput & VbCrLf & strFirstLine
objRecordSet.MoveNext
Wend

WriteCon
WriteFile




'=======================================================
' FUNCTIONS
'=======================================================

Sub WriteFile
'Open new text file, write info, close file
If IsEmpty(strOutputFile) Then
WScript.Echo "No file output"
Else
Set objFSO =
CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strOutputFile)
'Write Stuff
objFile.WriteLine strOutput
'Close text file
objFile.Close
End If
End Sub

'---------------------------------
'SUB Write Console
Sub WriteCon
If Not colNamedArguments.Exists("s") Then
WScript.echo strOutput
Else
WScript.Echo "No console output"
End If
End Sub

'------------------

Sub WriteHelp
If colNamedArguments.Exists("help") Then
strHelpText = "USAGE: ListDistGroups_audit-dev.vbs" & VbCrLf &
"OPTIONAL Arguments: /s:y - no console output" & VbCrLf & _
"/f:Output_File_Name.txt - writes output to txt file in the
argument" & VbCrLf & "/help - help text" & VbCrLf & _
" ListDistGroups_audit-dev.vbs /f:c:\DistributionGroups.txt
/s:y -
produces " & VbCrLf & "file DistributionGroups.txt " & " and no console
output"
WScript.Echo strHelpText
WScript.Quit
End If
End Sub







"krazymike" wrote:

Yeah, I'd like to see the code, especially the line it's failing on.



.



Relevant Pages

  • Re: What is A Bandwagoner/Fair Weather Fan?
    ... members of this group as bandwagoners or fair weather fans I thought I would start a new post with my definition of a bandwagoner and why I call certain members of this group with that appellation. ... TO THE PLAYERS and MANAGER, ... passive/avoidant FWF because in the former case you have active negativism while in the latter case just apathy. ... I'll assume you mean the fan, ...
    (alt.sports.baseball.bos-redsox)
  • Re: The only thing that might save Sky & Tel and other mags
    ... The manager gets 10% off the ... members and public used to use. ... Newtonian telescope for which we are the stewards and that a very ... As for our "manager," club members, students, and the public have ...
    (sci.astro.amateur)
  • Re: How to tally group membership for huge group +10k accounts?
    ... The first thing I did was run your ADO Large Group and it stops at ... recordset with thousands of rows. ... ' Use ADO to search the domain for members of the group. ... you could enumerate the recordset with: ...
    (microsoft.public.windows.server.scripting)
  • Re: Determine who is not a member of "common users"
    ... You must specify the Distinguished Name of the group. ... ' Setup ADO objects. ... ' Filter on user objects that are not members of specified group. ... ' Construct the LDAP syntax query. ...
    (microsoft.public.scripting.vbscript)
  • Re: How to tally group membership for huge group +10k accounts?
    ... To document groups with more than 1500 members you have to use ADO range ... recordset with thousands of rows. ... ' Use ADO to search the domain for members of the group. ... you could enumerate the recordset with: ...
    (microsoft.public.windows.server.scripting)