Member Avatar for Jbvo

I am tring to call the same subroutine several times. The first time it runs it works correctly. Everytime after the first time it doesn't run the subroutine in order. I was wondering if anyone knows how to do this. Here is my current script.

@echo off

set description=Disabled %date:~4,2%-%date:~7,2%-%date:~10,4%

set return=next1
set value="Domain Controllers,DC=dtint,DC=com"
GoTO :Program
:next1
set return=next2
set value="Computers,DC=dtint,DC=com"
GOTO :Program
:next2
set return=next3
set value="Computers,OU=DTI-AU,OU=DTI-Offices,OU=DTI-Admin,DC=dtint,DC=com"
GOTO :Program
:next3
GOTO :END

:Program

dsquery computer ou=%value% -inactive 10 -limit 0 > C:\ComputersDisableSept17-2012.txt

@echo Number of Inactive Computers:

dsquery computer ou=%value% -inactive 10 -limit 0 | find "CN=" /c

@echo Disabling Computers

dsquery computer ou=%value% -inactive 10 -limit 0 | dsmod computer -disabled Yes -desc "%description%"

@echo Moving Computers

for /F "Tokens=*" %%i in (C:\ComputersDisableSept17-2012.txt) do dsmove %%i -newparent OU=ToBePurged,OU=DTI-Admin,DC=dtint,DC=com

GOTO %return%

:END

Thanks

Member Avatar for Jbvo

I had a bad path in the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.