PowerShell Move AD Account

Hi Team. 

What am i doing wrong here? I am setting up a work flow to move a user account based on the Office value being something. For example if office value = London then it runs this powershell in the Workflow. 

However no matter what i supply after the Move-QADObject it just errors out on me. 

Any ideas what i am doing wrong? 

function MoveLondon($Request)
{
Connect-QADService -Service "AR-SERVER-NAME" -Proxy 
$OU = "OU=HERE"
Move-QADObject $Request -NewParentContainer $OU

Parents
  • Ok so the code below is moving the AD account to the correct OU

    function MoveLondon($Request)
    {
    Connect-QADService -Service "AR-SERVER-NAME" -Proxy 
    $Username = $DirObj.get("samaccountname")
    $OU = "OU=HERE"
    Move-QADObject $Username -NewParentContainer $OU

    However i am getting a big red box with the details below. I am opening the user account and changing the office value from say Glasgow to London. The account is being moved from Glasgow to London but i see this error message. 

    An error occurred during this operation. For details, see the error description below.

    • 'Built-in Policy - Default Rules to Generate Properties' returned an error. Administration Service encountered an error when retrieving properties of the object 'CN=SOMETHING-HERE'. Directory object not found. (Exception from HRESULT: 0x8007208D
Reply
  • Ok so the code below is moving the AD account to the correct OU

    function MoveLondon($Request)
    {
    Connect-QADService -Service "AR-SERVER-NAME" -Proxy 
    $Username = $DirObj.get("samaccountname")
    $OU = "OU=HERE"
    Move-QADObject $Username -NewParentContainer $OU

    However i am getting a big red box with the details below. I am opening the user account and changing the office value from say Glasgow to London. The account is being moved from Glasgow to London but i see this error message. 

    An error occurred during this operation. For details, see the error description below.

    • 'Built-in Policy - Default Rules to Generate Properties' returned an error. Administration Service encountered an error when retrieving properties of the object 'CN=SOMETHING-HERE'. Directory object not found. (Exception from HRESULT: 0x8007208D
Children
No Data