Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
June 6, 2006
Using ADMod.exe freeware, I have scripted MoveOU.bat to move all the Distinguished Names that you specify in a file to a new, common, OU.
The syntax for using MoveOU.bat is:
MoveOU Filename "New OU"
Where:
FileName is the file that contain the quoted Distinguished Names, one per line, that you want to move to New OU. Example: "CN=TESTCOMP,CN=Computers,DC=JSIINC,DC=COM" "CN=TESTUSER,OU=West Coast,DC=JSIINC,DC=COM"New OU is the new OU that you want all the objects in FileName to be moved to, like "OU=East Coast,DC=JSIINC,DC=COM"
MoveOU.bat contains:
@echo offif {%2}=={} @echo Syntax: MoveOU Filename NewOU&goto :EOFif not exist %1 @echo MoveOU %1 does not exist.&goto :EOFsetlocalset file=%1set newou=%2for /f "Tokens=*" %%a in ('type %file%') do ( admod -b %%a -unsafe -move %newou%)endlocal
You May Also Like