Which command line utility can be used to move an Active Directory object from one container to another?

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Dsmove

  • Article
  • 08/31/2016
  • 2 minutes to read

In this article

Applies To: Windows Server 2003, Windows Server 2008, Windows Server 2003 R2, Windows Server 2012, Windows Server 2003 with SP1, Windows 8

Moves a single object, within a domain, from its current location in the directory to a new location, or renames a single object without moving it in the directory tree.

Dsmove is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsmove, you must run the dsmove command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

dsmove <ObjectDN> [-newname <NewRDN>] [-newparent <ParentDN>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter

Description

<ObjectDN>

Required. Specifies the distinguished name of the object that you want to move or rename. If the value is omitted, it is obtained through standard input (stdin) to support piping of output from another command to input of this command.

-newname <NewRDN>

Renames the object that you specify with a new relative distinguished name.

-newparent <ParentDN>

Specifies a new location for the object that you want to move. To specify the new location, you supply the distinguished name of the object's new parent.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmove connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, )

-p {<Password> | *}

Specifies to use a password or an asterisk (*) to log on to a remote server. If you type *, dsmove prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmove formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To rename a user object from Kim Akers to Kim Ralls, type:

dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newname "Kim Ralls"

To move the user object for Kim Akers from the Sales organization to the Marketing organization, type:

dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newparent OU=Marketing,DC=Contoso,DC=Com

To combine the rename and move operations, type:

dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newparent OU=Marketing,DC=Contoso,DC=Com -newname "Kim Ralls"

Additional references

Command-Line Syntax Key

Windows Server 2003 provides a number of tools that allow you to move objects within domains and between them.The tools that can be used for moving objects include Active Directory Users and Computers, and two command-line utilities. As we've seen, Active Directory Users and Computers is an MMC snap-in that allows you to interact with Active Directory through a graphical interface. The DSMOVE and MOVETREE are command-line tools that allow you to move objects by entering textual commands at the command prompt. In the sections that follow, we will look at these tools, and see how they can be used to move objects within and between domains.

Moving Objects with Active Directory Users and Computers

Active Directory Users and Computers can be used to move user, computer, and group accounts to other locations of the directory.With this tool, objects can be moved within a domain. It can't, however, be used to move objects to other domains.

Active Directory Users and Computers is the only tool that allows you to move accounts using a GUI. Because it's a graphical tool, you can move Active Directory objects using your mouse. Select an object by holding down your left mouse button, drag the object to a different container or OU, and release the left mouse button to drop it into the new location.

In addition, you can also move objects within the directory by right-clicking on the object, and selecting Move from the context menu. A dialog box will appear asking you to choose the container or OU the object should be moved to. As seen in Figure 2.44, the

Move dialog box displays a tree that represents the directory tree. By browsing the folders in this tree, you can select the container you want the object moved to, and then click OK to being the move.

Figure 2.44 Move Dialog Box

Which command line utility can be used to move an Active Directory object from one container to another?

When using Active Directory Users and Computers, multiple objects can be selected and moved to other locations.You can select these objects as you would files in Windows Explorer, by dragging your mouse over the objects to be moved.You can also select a series of objects by holding down the Shift key as you click on objects, or select a number of individual objects by holding down the Ctrl key as you click on them. After selecting the objects to be moved, perform the actions we just discussed to move them to another container or OU.

Moving Objects with the DSMOVE Command

As we saw in Chapter 1, DSMOVE is used to move objects within a domain, and can be used to rename objects. DSMOVE is a command-line utility that is used from the command prompt. Providing you don't need to move an object to another domain, you can use this tool to move an object to other locations in the directory tree. The syntax for using this tool is as follows:

DSMOVE UserDN [-newparent ParentDN] -pwd {Password/*}

In using this syntax, several different parameters must be entered for moving the object. The UserDN parameter specifies the DN of the object being moved.The -newparent switch indicates that you are using DSMOVE to move an object, and is used with the ParentDN variable to specify the DN of the new location.

To illustrate how this command is used, let's say you wanted to move an object called BuddyJ from the Sales OU in knightware.ca to the Finance OU in the same domain.To move this object, you would use the following command:

Dsmove CN=BuddyJ,OU=Sales,DC=knightware,DC=ca -newparent OU=Finance,DC=knightware,DC=ca

Test Day Tip_

DSMOVE is a new tool for managing Active Directory. This command-line tool will only allow objects to be moved within a domain. For moving objects to other domains, the MOVETREE command-line utility (which we'll discuss later in this chapter) must be used.

DSMOVE also provides additional parameters to perform actions such as renaming an object, or controlling the type of input and output for this command. To review these parameters, refer to the section on DSMOVE in Chapter 1.

Moving Objects with the MOVETREE Command

MOVETREE is the Active Directory Object Manager tool. In addition to other capabilities, it is a command-line tool that allows you to move objects to other domains in a forest. By using this tool, you have the freedom to move a user account, computer account, group, or OU to any location within the directory, regardless of the domain.

When an object is moved using this tool, it is first copied to the Lost and Found container before being moved to the destination domain. Objects that can't be moved remain in this container, so you can manage them as needed. Because orphaned data might reside in this domain after using MOVETREE, you should check this container after performing a move.

Exam Warning_

The Active Directory Object Manager is MOVETREE.EXE. This tool isn't automatically installed with Active Directory and must be installed separately with the Active Directory Support Tools on the installation CD. This tool allows you to move objects from one domain to another in Active Directory.

A variety of information isn't moved with this tool. This includes data such as profiles, logon scripts, and personal information when moving user accounts. Local groups and global groups also aren't moved, but membership in these groups remains unaffected so that security involving the moved objects remains the same.

In addition to the limitations on data associated with accounts, there are also limitations when MOVETREE is used to move OUs between domains.When an OU is moved, group policies aren't affected, as clients will continue to receive these settings from a link to the policy in the original domain. In other words, although the OU is now in another domain, clients will connect to the Group Policy Object (GPO) that is located in the orig inal domain. Because this can cause performance issues, it is wise to recreate these policies in the domain where the OU has been moved, and then delete the GPO in the original domain (which is no longer needed).

As a command-line tool, MOVETREE requires that certain parameters be used to effectively complete operations. The syntax for MOVETREE is as follows, and the parameters are explained in Table 2.6.

MoveTree [/start | /continue | /check] [/s SrcDSA] [/d DstDSA]

[/sdn SrcDN] [/ddn DstDN] [/u Domain\Username] [/p Password] [/quiet]

Table 2.6 Parameters for MOVETREE

Parameter

Description

/start

Specifies whether to start a move with a /check option,

or with the /startnocheck option, which starts the

operation without a check.

/continue

Specifies to continue the move after a failure.

/check

Specifies to check the entire tree before moving an

object.

/s SrcDSA

The SrcDSA variable is used to specify the FQDN of the

source server.

/d DstDSA

The DstDSA variable is used to specify the FQDN of the

destination server.

/sdn SrcDN

The SrcDN variable is used to specify the source sub

tree's root DN.

/ddn DstDN

The DstDN variable is used to specify the destination

subtree's root DN.

/u Domain\Username

Specifies the domain and user account to use for the

operation.

/p Password

Specifies the password of the account to use for the

operation.

/quiet

Specifies that quiet mode should be used, suppressing

output.

The Active Directory Object Manager tool isn't installed with Active Directory, and thereby isn't initially available for use. MOVETREE is available as part of the Active Directory Support Tools on the installation CD, and can be installed through Windows Explorer. By accessing the Support\Tools folder on the installation CD, right-clicking on SUPTOOLS.MSI, and then choosing Install from the menu that appears, the Windows Support Tools Setup Wizard will start. By following the instructions in this wizard, which are detailed in Exercise 2.06, MOVETREE and the other support tools will be installed.

Continue reading here: Creating an Extensive Defense Model

Was this article helpful?

Which of the following command

Moving Objects with the DSMOVE Command DSMOVE is a new tool for managing Active Directory. This command-line tool will only allow objects to be moved within a domain. For moving objects to other domains, the MOVETREE command-line utility (which we'll discuss later in this chapter) must be used.

What is Dsmove command?

Dsmove is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsmove, you must run the dsmove command from an elevated command prompt.

Which of the following command is used to import or export Active Directory data to a file?

You can also use ldifde to extend the schema, export Active Directory user and group information to other applications or services, and populate Active Directory Domain Services (AD DS) with data from other directory services. Ldifde is a command-line tool that is built into Windows Server 2008.

Which of the following commands can be used to import from and export to a file the Active Directory objects?

Use Csvde to import and export Active Directory objects. Use Domain Services (DS) commands to create and manage Active Directory objects.