devxlogo

Use Recursion to Simplify Object Deletion Using ADSI and VBScript

Use Recursion to Simplify Object Deletion Using ADSI and VBScript

An object in a Netscape Directory Server can only be deleted if it is a terminal node. This restriction causes the writing of source code to delete an object and all of the object’s children in the directory to be very complex. However, recursion can greatly simplify this operation.In the VBScript below, the code makes recursive calls to itself if the current object, oBj, has children. Eventually, recursion stops when a terminal node is reached and this node is deleted. As the process traces back up the stack through all of the recursions, each node is deleted until the starting node, sADsPathParent, is reached.

 '********************************************************'Purpose: CAUTION - Deletes the object and all child objects!!!!''Language: VBScript'********************************************************Sub RecurLDAPDelete(sADsPathParent) Dim oTarget Dim oBj Dim oBjParent Dim oKid dim strADMIN_DN dim strADMIN_PW  strADMIN_DN = Application(
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist