2010/08/01

Move a Computer Object to an OU

I’m currently working on the configuration of HP Rapid Deployment Pack (RDP) and I had to create a task who will automatically move the Computer object in the good OU.

So I want to move a computer object 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 and the SITENUMBER from the SERVERNAME i would use the code below, it will select

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

More information about DSMOVE

No comments:

Post a Comment