I need to remove 1000 computers from AD. I tried the script below, but it's not working. When I used dsmod
to disable computers, in the same script, it works.
@echo off
set ComputerList=C:\Users\a058059x\Desktop\Machines.txt
for /f "delims=" %%a in ('type "%ComputerList%"') do (
echo Processing %%a ...
dsquery computer -name "%%a" | dsrm
)
Can anyone help me to correct the error in this script?