Renaming and Moving Objects

 < Day Day Up > 



Renaming and moving objects within a domain is handled with the DSMOVE command. Why one command instead of two? Because when you rename an object, you actually move it from its current DN to a new DN. Remember, a DN has two parts: a common name or RDN, and a location.

The syntax for DSMOVE is as follows:

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

To rename a user, computer, group, or other Active Directory object, you must specify the object’s DN and then use the –Newname parameter to specify the new relative name. You could rename a user object from William Stanek to William R. Stanek, by typing dsmove “CN=William Stanek,OU=Tech, DC=cpandl,DC=Com” –newname “William R. Stanek”.

To move a user, computer, group, or other Active Directory object within a domain, you must specify the object’s current DN and then use the –Newparent parameter to specify the new location or parent DN of the object. Suppose, for instance, that you wanted to move a user account from the Tech OU to the Engineering OU. Here, you would specify the object’s DN, such as “CN=William Stanek,OU=Tech,DC=cpandl,DC=com”, and provide the DN for the new location, such as “OU=Engineering,DC=cpandl,DC=com”. The related command would look like this:

dsmove "CN=William Stanek,OU=Tech,DC=cpandl,DC=com" -newparent  OU=Engineering,DC=cpandl,DC=com

To rename an object while moving it, you simply add the –Newname parameter to give the object a new name. Consider the following example:

dsmove "CN=William Stanek,OU=Tech,DC=cpandl,DC=com" -newparent 
OU=Engineering,DC=cpandl,DC=com -newname "William R. Stanek"

Here, you move the William Stanek user account to the Engineering OU and rename it William R. Stanek.

In any of these examples, we could have obtained the object DN by means of the DSQUERY command. To do this, you simply pipe the output of DSQUERY to DSMOVE, as shown in this example:

dsquery user -name "William Stanek" | dsmove -newname "William R. 
Stanek"

Here, the object DN, "CN=William Stanek,OU=Tech,DC=cpandl,DC=Com", is obtained from DSQUERY USER and used as input to DSMOVE, which results in the renaming of the User object.

Tip

Want to move objects between domains? Use the MOVETREE command in the Windows Support Tools. Similar to DSMOVE, this command requires source and destination DNs for objects you are moving. You must also connect to a specific domain controller in the source and destination domains.



 < Day Day Up > 



Microsoft Windows Command-Line Administrator's Pocket Consultant
MicrosoftВ® WindowsВ® Command-Line Administrators Pocket Consultant
ISBN: 0735620385
EAN: 2147483647
Year: 2004
Pages: 114

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net