Questions

Answer for:

Computer removal in AD

Message 20 of 20

View entire thread
+
0 Votes
Lepide

what you are talking about s the user management.
try the script:
On Error Resume Next

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\Files\ws.txt", ForReading)

Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.Readline

Set objComputer = GetObject("LDAP://CN=" & strComputer & _
"," & "OU=WorkStations,DC=myCompany,DC=com")
objComputer.DeleteObject (0)
If Err.Number = 0 Then
Err.Clear
WScript.Echo "Deleted computer " & strComputer & " from AD"
Elseif Err.Number <> 0 Then
Err.Clear
WScript.Echo "Unable To delete computer " & strComputer
End If
Loop

objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
Set objComputer = Nothing
Set objContainer = Nothing

Wscript.Echo "Done"

or u can go for some AD tools like: http://www.manageactivedirectory.com/