Move an AD object or a container of objects to a different container or domain.

      Move-ADObject [-Identity] ADObject [-TargetPath] string 
         [-AuthType {Negotiate | Basic}] [-Credential PSCredential]
            [-Partition string] [-PassThru] [-Server string] [-TargetServer string]
               [-Confirm] [-WhatIf] [CommonParameters]

   -AuthType {Negotiate | Basic}
       The authentication method to use: Negotiate (or 0), Basic (or 1)
       A Secure Sockets Layer (SSL) connection is required for Basic authentication.

   -Credential PSCredential
       The user account credentials to use to perform this task.
       The default credentials are those of the currently logged on user unless the
       cmdlet is run from an Active Directory PowerShell provider drive.
       If the cmdlet is run from such a provider drive, the account associated with the drive is the default.

       Type a user name, such as "User64" or "Domain64\User64" or specify a
       PSCredential object such as one generated by Get-Credential 

       If a user name is specified, the cmdlet will prompt for a password.

   -Identity ADObject
       An AD object. Most often this will be a Distinguished Name (e.g. CN=sample1,OU=demo,DC=SS64,DC=com)
       The identity may also be given as a GUID.

       Derived types, such as the following are also accepted:

       The cmdlet searches the default naming context or partition to find the object.
       If two or more objects are found, the cmdlet returns a non-terminating error.

       The ADObject may also be passed through the pipeline or set via a variable.

   -Partition string
       The distinguished name of an AD partition.
       string must be one of the naming contexts on the current directory server.
       The cmdlet searches this partition to find the object defined by the -Identity parameter.
         -Partition "CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM"
         -Partition "CN=Schema,CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM"

       In many cases, a default value will be used for -Partition if no value is specified.

   -PassThru switch
       Return the new or modified object.
       By default (i.e. if -PassThru is not specified), this cmdlet does not generate any output.
   -Server string
       The AD Domain Services instance to connect to, this may be a Fully qualified domain name,
       NetBIOS name, Fully qualified directory server name (with or without port number)

   -TargetPath string
       The new location for the object.
       This location must be the path to a container or organizational unit (OU).

   -TargetServer string
       The AD instance to use (domain name or directory server). 

       Prompt for confirmation before executing the command.

       Describe what would happen if you executed the command without actually executing the command.

Move-ADObject moves an object or a container of objects from one container to another or from one domain to another.

The -Identity parameter specifies the AD object or container to move. This may be identified by a distinguished name (DN), a GUID , an object variable or set through the pipeline. e.g. by using Get-ADObject, Get-ADGroup, Get-ADUser, Get-ADComputer, Get-ADServiceAccount, Get-ADOrganizationalUnit or Get-ADFineGrainedPasswordPolicy.

The -TargetPath parameter must specify the new location for the object or container.


Move the OU 'Strasbourg' to a new location. For the move to be successful, the OU 'Strasbourg' must NOT be protected from accidental deletion:

PS C:\> Move-ADObject -Identity "OU=Strasbourg,DC=SS64,DC=Com" -TargetPath "OU=Paris,DC=SS64,DC=Com"

Move an object identified by its GUID to a new location:

PS C:\> Move-ADObject "4d0bcc44-c425-4dd8-af3c-2c66760fbd21" -TargetPath "OU=Paris,DC=SS64,DC=Com"

Move an object to a different domain:

PS C:\> Move-ADObject -Identity "CN=Mary Vick,OU=Accounting,DC=SS64,DC=com" -TargetPath "OU=Accounting,DC=Europe,DC=SS64,DC=com" -TargetServer ""

“Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don’t quit” ~ Conrad Hilton

Related PowerShell Cmdlets

Get-adObject - Get one or more AD objects.
New-adObject - Create an AD object.
Remove-adObject - Remove an AD object.
Rename-adObject - Change the name of an AD object.
Restore-adObject - Restore an AD object.
Set-adObject - Modify an AD object.

Copyright © 1999-2024
Some rights reserved