Directory Services |
To remove a user, call the IADsContainer.Delete method of the user parent object.
The following code example removes a user.
'Deletes a user object given the ADsPath of the user. 'Does nothing if the object is not a user Public Sub DeleteUser(strUserADsPath As String) Dim obj As IADs Dim parent As IADsContainer 'Bind to the object Set obj = GetObject(strUserADsPath) 'If the ADsPath passed is not ot a group object, just exit If "user" <> LCase(obj.Class) Then Exit Sub End If 'Bind to the parent of the object Set parent = obj.parent 'Delete the object parent.Delete obj.Class, obj.Name End Sub