

One of the beneficial but lesser used features of the Active Directory Users and Computers snap-in is the Manage command. ObjOU.MoveHere “LDAP://ComputerDN”, vbNullString Managing a Computer from the Active Directory Users and Set objOU = GetObject(“LDAP://TargetOUDN”) With VBScript, you connect to the source container and use the container’s MoveHere method:
REJOIN COMPUTER TO DOMAIN POWERSHELL CODE
The following two lines of code will move a computer:
REJOIN COMPUTER TO DOMAIN POWERSHELL WINDOWS
To move a computer in Windows PowerShell, you must use the psbase.MoveTo method.

To move a computer named XP021 from the Computers container to the ClientsXP OU, you would type the following:ĭsmove “CN=XP021,CN=Computers,DC=es-net,DC=co,DC=uk” –newparent “OU=ClientsXP,DC=es-net,DC=co,DC=uk” The newparent parameter enables you to move an object. The newname parameter enables you to rename an object. The Dsmove command allows you to move a computer object or any other object. The target OU might also be within the scope of different GPOs, which would change the configuration of settings on the system itself. The target OU might have different permissions than the originating OU, in which case, the object will inherit new permissions affecting who is able to manage the object further. Administrators, which include Domain Admins and Enterprise Admins, can move computer objects between any containers, including the Computers container, the Domain Controllers OU, and any other OUs.īefore you move a computer, consider the implications to delegation and configuration. Default permissions allow Account Operators to move computer objects between containers, including the Computers container and any OUs except into or out of the Domain Controllers OU. You must have appropriate permissions to move an object in Active Directory. You can move a computer in the Active Directory Users and Computers snap-in using either drag and drop or the Move command, available when you right-click a computer. In both cases, if the value is a text value, it must be surrounded by quotes. Set objComputer = GetObject(“LDAP://DN of Computer”) The Windows PowerShell commands are as follows:

