Automation - Deleting a User Object

Dim Container as IADsContainer
Dim User as IADsUser
Dim UserPath as String
 
' Bind to the known object.  In this case, we happen to know
' the explicit path, but typically the object will be discovered
' using query or enumeration.
Set User = GetObject("WinNT://MyDomain/Users/Jane")
 
' Get the container of the user object.
Set Container = GetObject(User.Parent)
 
' Delete the user.
Call Container.Delete("user",User.name)
 
' Release the user object.  Note that we deleted
' the underlying DS object, so we should not hang on to the user
' component.
Set User = Nothing