Direct Inward Dialing: +1 408 916 9393
Moving a computer account to a different organizational unit (OU) changes which Group Policy settings and delegated permissions apply to it. This is why it's a routine part of reorganizing a domain, onboarding machines from the default Computers container, or staging devices during imaging. This guide covers moving computer accounts using three methods: the Move-ADObject cmdlet in PowerShell, the Active Directory Users and Computers (ADUC) console, and ManageEngine ADManager Plus.
Import-Module ActiveDirectory
Move-ADObject accepts an objectês distinguished name (DN) or GUID for -Identity. Get-ADComputer also accepts a computerês sAMAccountName, such as WKSTN-0421. Use Get-ADComputer to look up the computer, then pipe the returned object to Move-ADObject. Specify the destination OU or containerês DN with -TargetPath:
Get-ADComputer -Identity "WKSTN-0421" | Move-ADObject -TargetPath "OU=Sales,DC=corp,DC=com"
If you don't know the destination OU's distinguished name, look it up with Get-ADOrganizationalUnit and pass the DN through:
$target = Get-ADOrganizationalUnit -LDAPFilter "(name=Sales)"
Get-ADComputer -Identity "WKSTN-0421" | Move-ADObject -TargetPath $target.DistinguishedName
If multiple OUs have the same name, the LDAP filter may return more than one result. Make sure you select the intended destination OU before running the move.
Because a move changes an object's location and the policy it receives, preview it first. The -WhatIf parameter reports what would happen without making the change, and -Confirm:$false suppresses the prompt in an unattended script:
# Preview only
Get-ADComputer -Identity "WKSTN-0421" | Move-ADObject -TargetPath "OU=Sales,DC=corp,DC=com" -WhatIf
# Run without a prompt
Get-ADComputer -Identity "WKSTN-0421" | Move-ADObject -TargetPath "OU=Sales,DC=corp,DC=com" -Confirm:$false
To move many machines at once, prepare a CSV with a Name column (and optionally a per-row OU column), and loop it through Move-ADObject. Resolve each computer to its distinguished name with Get-ADComputer so the -Identity value is unambiguous:
$targetOU = "OU=Workstations,DC=corp,DC=com"
Import-Csv "C:\Imports\computers.csv" | ForEach-Object {
$computer = Get-ADComputer -Identity $_.Name
Move-ADObject -Identity $computer.DistinguishedName -TargetPath $targetOU -Confirm:$false
Write-Host "Moved $($computer.Name)"
}
Passing a computer name directly to Move-ADObject can result in an identity resolution error, such as the Cannot find an object with identity error, since the cmdlet expects a distinguished name, GUID, or SID. Resolving the object with Get-ADComputer first prevents the issue.
After moving, confirm each computer's new location by reading its distinguished name:
Get-ADComputer -Identity "WKSTN-0421" | Select-Object Name, DistinguishedName
If a move fails with an access is denied error even though you have rights, the object may have ProtectedFromAccidentalDeletion enabled, which also blocks moves. Clear it first, then move the computer:
Set-ADObject -Identity (Get-ADComputer "WKSTN-0421").DistinguishedName -ProtectedFromAccidentalDeletion $false
Use caution when disabling accidental-deletion protection. Re-enable it after the move if the object should remain protected.
In an environment with multiple domain controllers, allow for AD replication, or initiate replication if necessary, before relying on the change being visible on every DC.
| Parameter/cmdlet | Description |
|---|---|
| Move-ADObject | Moves an object to a different OU or container |
| -Identity | The object to move, given as a distinguished name, GUID, or SID |
| -TargetPath | The distinguished name of the destination OU |
| -WhatIf | Previews the move without applying it |
| -Confirm:$false | Suppresses the confirmation prompt for unattended scripts |
| Get-ADComputer | Retrieves a computer object; used to resolve its distinguished name |
| Get-ADOrganizationalUnit | Finds the destination OU's distinguished name |
| Set-ADObject -ProtectedFromAccidentalDeletion | Clears deletion protection, which otherwise blocks a move |
ADManager Plus is a unified AD, Exchange, and Microsoft 365 management and reporting tool that lets administrators move individual computer accounts or multiple computer accounts simultaneously through a point-and-click console without writing scripts. It also maintains an audit trail of administrative actions.
ADManager Plus also enables you to move computers directly from a report. For example, generate a computer report, select the computers you want to move, click ellipsis (...), and select Move Computers.
Use ADManager Plusê Automation to move newly joined computers to the appropriate OUs or relocate computers that have been inactive over a period to support Active Directory cleanup. Route sensitive moves through approval workflows so each move is signed off before it runs.
ADManager Plus replaces scripts and one-off console edits with a single console for AD, Microsoft 365, and Exchange management and reporting:
A common need is relocating a single machine out of the default Computers container into a department or site OU, so it picks up the right Group Policy. If you don't know the destination OU's distinguished name, retrieve it first, then pipe the computer into the move.
$target = Get-ADOrganizationalUnit -LDAPFilter "(name=Charlotte)"
Get-ADComputer "WIN7-C1" | Move-ADObject -TargetPath $target.DistinguishedName
When machines are spread across many OUs and need to be consolidated, a CSV-driven move handles them in one run. The reliable pattern resolves each computer to its distinguished name before moving it, which avoids the Cannot find an object with identity error that a bare name produces.
$targetOU = "OU=NewOU,DC=corp,DC=com"
Import-Csv "C:\Imports\computers.csv" | ForEach-Object {
$computer = Get-ADComputer -Identity $_.Name
Move-ADObject -Identity $computer.DistinguishedName -TargetPath $targetOU -Confirm:$false
Write-Host "$($computer.Name) moved successfully"
}
In a VM-provisioning or imaging flow, a new computer account first lands in the default container, and the next task often fails unless the machine is already in its target OU. Because build times vary, a fixed delay is unreliable; instead, check every three seconds until the computer account appears in AD, then move it to the target OU.
do {
Start-Sleep -Seconds 3
} until (Get-ADComputer -Identity $serverName -ErrorAction SilentlyContinue)
$serverDN = (Get-ADComputer -Identity $serverName).DistinguishedName
Move-ADObject -Identity $serverDN -TargetPath $targetOU
For imaging with Configuration Manager (formerly SCCM), a task-sequence step can run the move against a domain controller using remoting, so the AD module doesn't need to be present in the task sequence:
Invoke-Command -ComputerName "dc1.corp.com" -ScriptBlock {
Import-Module ActiveDirectory
Get-ADComputer $args[0] | Move-ADObject -TargetPath "OU=Workstations,DC=corp,DC=com"
} -ArgumentList $env:computername
Use Automation to move newly created computers that match a naming pattern to the designated OU according to a configured schedule or automation rule, so staging doesn't depend on timing a script to the build.
On a machine that doesn't have the Active Directory module, you can still move a computer object. One option is to proxy the cmdlets to a domain controller with remoting; another is the ADSI approach, which uses no modules at all.
Invoke-Command -ComputerName "dc1.corp.com" -ScriptBlock {
Import-Module ActiveDirectory
Get-ADComputer "WKSTN-0421" | Move-ADObject -TargetPath "OU=Sales,DC=corp,DC=com"
}
$computer = [ADSI]"LDAP://CN=WKSTN-0421,CN=Computers,DC=corp,DC=com"
$targetOU = [ADSI]"LDAP://OU=Sales,DC=corp,DC=com"
$targetOU.MoveHere($computer.ADsPath, $null)
The web console moves computers from any browser, with no module or RSAT on the technician's machine needed, so this constraint doesn't arise.
Moving a computer in Active Directory means relocating its account object from one OU to another. The computer itself and its domain membership are unchanged; what changes is which Group Policy and delegated permissions apply to it, since those are tied to the OU. In PowerShell, a move is done with Move-ADObject -TargetPath.
A computer is usually added to AD by joining it to the domain from the device itself through Windows' domain-join settings. This creates its account automatically in the default Computers container. To create the account ahead of time (pre-staging), use New-ADComputer -Name "WKSTN-0421" -Path "OU=Workstations,DC=corp,DC=com" in PowerShell, or create it in Active Directory Users and Computers. You can then move it between OUs as covered above.
Use Get-ADComputer with a filter and pipe it to Export-Csv. For a script-free approach, ADManager Plus generates detailed computers reports that can be scheduled and exported in different formats.