2
PS C:\Users\Administrator> Get-ADComputer NAME | Move-ADObject -TargetPath "OU=SERVERS,OU=COUNTY,
OU=STATE,OU=REGION,OU=COUNTRY,DC=subdomain,DC=mydomain,DC=com"

However, I am getting this:

Move-ADObject : The operation could not be performed because the object's parent is either uninstantiated or deleted

Any idea what I am doing wrong?

Is ADComputer not piping over correctly? Examples show this is valid.

I am trying to move the computer to a new OU out of the default.

Jason
  • 3,931
  • 19
  • 66
  • 107

2 Answers2

1

One way to get this error message is to have a spelling error somewhere in the DN for the OU path. A possible test for this is to use something like

Get-ADOrganizationalUnit -lDAPFilter "(name=SERVERS)"

Look at the DistinguishedName property and see if there is any difference. You can also capture the resulting object and pass the DistinguishedName property to the Move-ADObject -TargetPath parameter. Something like:

$newServer = Get-ADComputer 'ServerName'
$targetOU = Get-ADOrganizationalUnit -lDAPFilter "(name=SERVERS)"
Move-ADObject -Identity $newServer -TargetPath $targetOU.DistinguishedName
0

This message is repeatable if your "-TargetPath" is incorrect, make the system give it to you.

$OU = (Get-ADOrganizationalUnit -Filter "name -like '[OUName]'").DistinguishedName Get-ADComputer [ComputerName] | Move-ADObject -TargetPath $OU

p0wd3r
  • 1