Get Current Domain Controller in ARS script

Hello.

I need to write a script which provisions a new user account in another application as part of provisioning a new user in ARS.  The application has PowerShell CMDLETS for doing this.  The application is located in another AD site and frequently the new user object has not replicated in AD to the other site before the attempt to provision the user in that application is made.  I've temporarily solved the problem by introducing a start-sleep in the ARS script however this isn't a great solution.

The CMDLets for provisioning the new user in the application do include a parameter which allows me to specify a DC directly.  I'd like to provide the provisioning commands the DC that the ARS admin server is pointed at, however I can't seem to find a way to programmatically determine what that is from within an ARS script.

I did some digging in the ARS SDK help file and found a reference to the following, that I thought would produce the current DC

$Session = $Security.Sessions.Current
$curDC = $session.OperationalController

However the $curDC seems to be blank.

Any other thoughts on how I might do this in an ARS event handler script.

Any help would be appreciated.

Craig.

Parents
  • Function OnPostCreate ($Request)

    {

    # This will tell me the "operational DC" for the domain where the last object create took place

    $MyWorkdingDC = $Request.Parameter('ldapserver')

    # Now do something with the contents of that variable

    }

    You can either use the above within a provisioning policy (embedded policy script) OR in a change workflow triggered by a user create (script activity).

Reply
  • Function OnPostCreate ($Request)

    {

    # This will tell me the "operational DC" for the domain where the last object create took place

    $MyWorkdingDC = $Request.Parameter('ldapserver')

    # Now do something with the contents of that variable

    }

    You can either use the above within a provisioning policy (embedded policy script) OR in a change workflow triggered by a user create (script activity).

Children