SourceObject As String,
NewName As String
) As IADs;
[in] String SourceObject
ADsPath of the source object (Group, User, Local group or Local User) to be moved.
[in] String NewName
New name for the moved object. If the string is empty, the name of the source object is retained.
Moves the given object to the current container.
The CopyHere property for IADsContainer supports copying of the following objects:
User, Group and Computer
User and Group
Directories and Files
Registry Keys and Registry Values
The newly moved object.
Moving a computer object to a domain container has the following prerequisites:
The destination domain should be trusted by the source domain. This implies that the destination domain should be in the list of trusted domains of the source domain.
The user performing this operation should be an administrator on the source domain, destination domain and the computer being moved.
After a computer is moved from one domain to another, you need to restart that computer for the changes to take effect.
Dim ContainerObject As IADsContainer
Dim UserName As IADsUser
Set ContainerObject = GetObject("NTDS://YourDomainName")
Set UserName = ContainerObject.MoveHere("NTDS://SrcDomainName/UserName", "NewName")