locked
80072023 the size limit for this request is exceeded for VB script RRS feed

  • General discussion

  • We have below script to fetch data from AD group and now we are having 80072023 the size limit for this request is exceeded error and partial records been loaded, could you please suggest how to increase the limit for below script.

    ADGroupList = split("ABC1,ABC2",",")



    Dim objGroup,objFSO, objFile
    Set objFSO=CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile( "D:\VBS_Script\AD_USER_MAPPING.csv",True)
    objFile.WriteLine "NT_GROUP,USER_DOMAIN,USER_NAME"
    For each strGroup in ADGroupList
    enumGroupMembers strGroup,  objFile
    Next

    enumAPCGroupMembers "XYZ",  objFile
    objFile.Close
    For each <g class="gr_ gr_97 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="97" id="97">strGroup</g> in ADGroupList
    enumGroupMembers strGroup,  objFile
    Next
    WScript.Echo "Done."
    objFile.Close

    Sub enumGroupMembers(strGroupName, byRef objFile)
    Dim rootDSE, strdomainDN, objASI, strGCDNS , ldapFilter, objRecSet, objConn, strUserDN, strUserSAM, strGroupDN
    Dim rowcount

    'initialize objects
    Set rootDSE = GetObject("LDAP://rootDSE")  'detect the own domain
    Set objASI = CreateObject("ADSystemInfo")     'detect the forest search base string
    Set objConn = CreateObject("ADODB.Connection")

    strdomainDN = rootDSE.Get("defaultNamingContext")
    strGCDNS = objASI.ForestDNSName
    objConn.Provider = "ADSDSOObject"
    objConn.Open "ADSearch" 

    'Query local domain to get Group DN
    ldapFilter = "(sAMAccountName=" & strGroupName & ")"
    Set objRecSet = objConn.Execute("<LDAP://" & strdomainDN & ">;" & ldapFilter & ";distinguishedName;subtree")
    strGroupDN = objRecSet.Fields("distinguishedName")

    'Query Global Catalogue to get Group members. include only user accounts and exclude service accounts
    ldapFilter = "(&(&(memberOf=" & strGroupDN & ")(objectClass=user))(!userAccountControl:1.2.840.113556.1.4.803:=65536))"
    Set objRecSet = objConn.Execute("<GC://" & strGCDNS & ">;" & ldapFilter & ";distinguishedName,samAccountName;subtree")
    rowcount= objRecSet.RecordCount

    'Write group members to file
    While Not objRecSet.EOF
    strUserDN = objRecSet.Fields("distinguishedName")
    strUserSAM = objRecSet.Fields("samAccountName")

    if instr(LCase(strUserDN), "dc=amer") > 0 then strUserDomain = "AMERICAS" ENd IF
    objFile.WriteLine  strGroupName & "," & strUserDomain & "," &  strUserSAM
    objRecSet.MoveNext
    Wend
    objConn.Close
    End Sub


    Sub enumAPCGroupMembers(strGroupName, byRef objFile)
    Dim rootDSE, strdomainDN, objASI, strGCDNS , ldapFilter, objRecSet, objConn, strUserDN, strUserSAM, strGroupDN
    Dim rowcount

    'initialize objects
    Set objConn = CreateObject("ADODB.Connection")
    objConn.Provider = "ADSDSOObject"
    objConn.Open "ADSearch"
    Set objRecSet = objConn.Execute("<GC://dell.com>;(&(&(memberOf=CN=XYZ,OU=Groups,DC=apac,DC=dell,DC=com)(objectClass=user))(!userAccountControl:1.2.840.113556.1.4.803:=65536));distinguishedName,samAccountName;subtree")
    rowcount= objRecSet.RecordCount

    'objFile.WriteLine "Row count for " & strGroupName & " is "  & rowcount

    'Write group members to file
    While Not objRecSet.EOF
    strUserDN = objRecSet.Fields("distinguishedName")
    strUserSAM = objRecSet.Fields("samAccountName")

    if instr(LCase(strUserDN), "dc=amer") > 0 then strUserDomain = "AMERICAS" ENd IF
    objFile.WriteLine  strGroupName & "," & strUserDomain & "," &  strUserSAM
    objRecSet.MoveNext
    Wend
    objConn.Close
    End Sub

    • Changed type Bill_Stewart Thursday, January 25, 2018 10:31 PM
    • Moved by Bill_Stewart Thursday, January 25, 2018 10:31 PM Unanswerable drive-by question
    Thursday, November 16, 2017 3:31 PM

All replies

  • We would recommend PowerShell rather than VBScript.

    Aside from that, please read the following:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Thursday, November 16, 2017 4:35 PM
  • You need to post complete error messages.

    VBScript has a very low limit for strings length compared to PowerShell.  In vbs it is 32767 in PowerShell it is 1.84467440737096E+19


    \_(ツ)_/

    Thursday, November 16, 2017 6:26 PM
  • Thanks for reverting back.

    I am using above script but it is displaying partial records with below error.

    (54, 3) Provider: The size limit for this request was exceeded.

    Monday, February 26, 2018 10:09 AM