deleting all users from active directory

prevs

New member
Joined
Sep 5, 2006
Messages
4
Programming Experience
Beginner
I need help with deleting all users from active directory, that is not including the default builtin ones of course this is the code I have so far.

remove all users from active directory
VB.NET:
Dim obj, oDom, strTemp, ouser
 
On Error Resume Next
oDom = GetObject("WinNT://Domain.com")
For Each oUser In oDom
If ouser.class = "user" Then
ouser.delete()
End If
Next
 
If Err.Number <> 0 Then
MsgBox(Err.Description)
End If
im new to programming in vb and progrmming in general but I can seem to get it to work it
would be appreciated if you could write the code changes if any.
 
Last edited by a moderator:
Back
Top