Get Current Domain Controller in ARS script


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.


Parents Reply Children
No Data