Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Error when attempting to move AD-User

$
0
0

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

My Script:

import-module activedirectory
import-csv c:\mylist.csv |
    foreach-object{
        $user=Get-AdUser $_.userid
        $dn=$user.distinguishedname
        $parent=([adsi]"LDAP://$dn").Parent.Replace('LDAP://','')
        $newdn="OU=disabled accounts,$parent"
        $newdn -replace "OU=Temporary Accounts,",  ""
        $user | Disable-ADAccount
        $user | Move-ADObject -targetpath $newdn -targetserver mgw-2k3-dc1.xyz.com
    }

So I tried  specifying a -targetserver, I receive error:

Move-ADObject : Can't move objects with memberships across domain boundaries as on
ce moved, this would violate the membership conditions of the account group. Remov
e the object from any account group memberships and retry

I'm assuming I'll have to query for the DC they reside on and make that the target for each object?



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>