Posts Tagged ‘OU’
Move a Computer Object to an OU
2010/11/01
Leave a comment
source: http://technet.microsoft.com/en-us/library/cc731094(WS.10).aspx
I want to move a computername to the good OU depending of the SERVERNAME
In my company we use the name convention MTL1ASTT01:
MTL is the city name
1 is the site number
A for application
STT custom info
01 number of the server
In our Active Directory we use:
DOMAIN.local > GLOBAL > %SITENAME% > SERVERS
So if want to get the SITENAME from the Servername i would use the code below:
echo. Getting Sitename from the Computer name…
Set SITENAME=%COMPUTERNAME%:0,4%
echo. SITENAME is %SITENAME%
dsmove “CN=%COMPUTERNAME%,OU=COMPUTERS,DC=DOMAIN,DC=LOCAL” -newparent OU=Servers,OU=%SITENAME%,OU=GLOBAL,DC=DOMAIN,DC=LOCAL
Categories: Active Directory, Scripting, VBS/BATCH
Active Directory, Bat, Batch, OU, Script