Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jan 8, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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(
John Lathrop
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date