How do you move a computer automatically from one OU to another using a script?

I was asked the following question recently when finishing our Citrix server deployment method.

We needed a script that would run on a computer as part of a sequence of scripts that would move a server from its current OU to the servers final resting place a terminal servers OU.

The below script achieved what we needed by using the computers %computername% variable to move the computer.

In our case the following apply:

·The computers name is using the variable %computername%

·The domain is

·The computers OU before the move is computers

·The OU we wish to move to is Terminal Servers

dsmove “CN=%computername%,OU=computers,DC=domain,DC=net” -d -newparent OU=”Terminal Servers”,DC=domain,DC=net

if you are unaware of the computers current OU before the move and you still wish to script the move, the following forum post will get you in the right direction.

Related Posts

Cataloging Exported packages from Frontrange Enteo... This is just a quick powershell script I threw together to catalog exported packages. By default when you export packages from Frontrange DSM (form...
Enabling RDP on a server remotely. There's very little more annoying in a windows environment than having to go to a console of a server because some idiot has disabled remote administr...
Remove shell extensions after installing Adobe Acr... A pet peeve of mine are context menu extensions... Why software vendors decide to include non optional context menu addons are besides me! A good exam...

One Comment About “How do you move a computer automatically from one OU to another using a script?

Leave a Reply