Move-ADObject
Use Move-ADObject to move an Active Directory object to a different organizational unit or container.
Documentation: Microsoft Learn — Move-ADObject
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Move-ADObject [-Identity] <ADObject> [-TargetPath] <String> [-TargetServer <String>] [-Server <String>] [-Credential <PSCredential>] [-PassThru] [-WhatIf] [<CommonParameters>]- Stage 1Move-ADObject
-Identity -TargetPath -TargetServer -Server -Credential -PassThru -WhatIf
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Move-ADObject -Identity "CN=SRV01,CN=Computers,DC=corp,DC=local"
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName : CN=SRV01,OU=Servers,DC=corp,DC=local DNSHostName : SRV01.corp.local Enabled : True Name : SRV01 ObjectClass : computer SamAccountName : SRV01$
Get-ADComputer -Properties ProtectedFromAccidentalDeletion
Show reference output
Sample output · fictional data, shaped like the real thing
ProtectedFromAccidentalDeletion ------------------------------- True True
Select DistinguishedName
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName ------------------------------------ CN=SRV01,OU=Servers,DC=corp,DC=local CN=SRV02,OU=Servers,DC=corp,DC=local
Parameters
Parameter definitions:
-Identity-TargetPath-TargetServer-Server-Credential-PassThru-WhatIf
Practical use and troubleshooting
Practical scenario: Use Move-ADObject when you need to move an Active Directory object to a different organizational unit or container. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Access denied can result from protection against accidental deletion or missing delegated rights. Inspect the object's protection and approved delegation instead of disabling safeguards blindly. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-ADOrganizationalUnit. Move-ADObject relocates a directory object; Get-ADOrganizationalUnit identifies OU targets. Validate the target distinguished name and the consequences of its linked policies before moving an account. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Move-ADObject Use Move-ADObject to move an Active Directory object to a different organizational unit or container.
Next: Get-ADObject