How to create a Dynamic Variable for Log On To Field in AD (Active Directory).
It may be desirable to obtain specific information from the user account in AD in order to create a dynamic variable and subsequently to use that variable in an element being run by the main engine of the script.
This article illustrates how to create a dynamic variable which will resolve to the data that is contained in the “Log On To...” field of a user account in Active Directory.
Create a dynamic variable based on information obtained from a user account in Active Directory.
The variable must first be defined in either a Global Options | Definitions (illustrated below) or a Profile specific definitions (select Profile | Definitions tab) in order to be processed for use during the execution of the main engine.
Example of a global definitions file entry to create a variable named $workstationLogons
Syntax from screenshot above:
$slADCurrentUser = GetObject($LDAP)
If not @error
$workstationLogons = $slADCurrentUser.userWorkstations
Once the variable has been defined in a definitions file, it can be used in any element because the definitions file is always processed prior to elements in the main engine. To test to see if the variable resolves properly, create a message box element to validate for the test user and simply enter the newly created variable in the body of the message box similar to the following:
I can log onto these workstations: $workstationLogons
Note: The creation and use of dynamic variables is considered to be custom scripting and is therefore not supported. This article was created as a service to our customers to demonstrate the extensibility of the product for those who are inclined to create their own custom variables.