Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: dsGetUsersGrps Error 1001 Bad ADSI path name dsGetUserGrps dsGetUsersGrp
I have changed my group names for now but the standard Microsoft tool for creating groups (Microsoft Exchange Management Console) allows you to create a group name with the "/". The ADUC (Microsoft's AD users and computers) tool warns you not to use "/" or other characters.
I prefer if you could ignore or accommodate these invalid names or at least give an error that is more useful like… "invalid ADSI path in this object or one of the groups that it is a member of"
I will add the error message change request to the enhancement list. For now it looks like you will need to capture for the 1001 error then use some alternative means to get a list of group names. Check out the following tech article:
; Probably will not work as is across domains. #DefineFunction GetAllGroups(strServer, strObjPath, plAllGroups) ; Look for a nested group. lMembership = dsGetProperty(strObjPath, "memberOf") nMemberOfs = ItemCount( lMembership, @TAB) For i = 1 To nMemberOfs ; Get the next group. strPath = ItemExtract(i, lMembership, @TAB) strPath = strServer:"/":strPath ; Check for tombstones. If dsIsObject(strPath) ; Prevent duplicates and infinity If ItemLocate(strPath, *plAllGroups, @TAB) Then Continue ; Add to group list *plAllGroups = ItemInsert(strPath, -1, *plAllGroups, @TAB) ; Add groups memeber to list GetAllGroups(strServer, strPath, plAllGroups) EndIf Next Return 1 #EndFunction AddExtender("WWADS44I.DLL") ; Construct the full domain ADSI path. ServerDn = dsGetProperty("LDAP://rootDSE", "serverName") ServerName = ItemExtract(1, ServerDn, ",") ServerName = ItemExtract(2, ServerName, "=") ; Set values by method of choice. strServer = "LDAP://":ServerName ; Our test server strUserSam = "homer simpson" ; !!!! A test user with convoluted group membership.!!!! lAllGroups = "" ; Get the full path. strUser = dsFindPath(strServer, "(&(objectCategory=person)(sAMAccountName=%strUserSam%))") If strUser == "" Message("Blah Blah Blah", "Bad user SAM name") Exit EndIf ; Get regular groups GetAllGroups(strServer, strUser, &lAllGroups) ; Get Primary group when necessary. strPrimGroup = dsGetPrimGrp(strUser) If !ItemLocate( strPrimGroup, lAllGroups, @TAB ) lAllGroups = ItemInsert(strPrimGroup, -1, lAllGroups, @TAB) GetAllGroups(strServer, strPrimGroup, &lAllGroups) EndIf AskItemlist("All Groups", lAllGroups,@TAB,@UNSORTED,@SINGLE) Exit
Article ID: W17527
Filename: dsGetUsersGrps Error 1001.txt
File Created: 2011:08:18:08:08:18
Last Updated: 2011:08:18:08:08:18