On a number of occasions over the years I have found myself needing to gain access to Active Directory attributes; maybe in login scripts or even in AppSense Environment Manager and in later releases Application Manager as well. Whether this be for establishing conditions and therefore providing granular configuration or maybe even to just use in an action of some kind.
Anyway, this is a quick post to show that this can be achieved quite easily. The script below has the ability to take the specified attributes and either set them as Environment Variables or AppSense Environment Manager Session Variables. The name of the variable created will be the same as the attribute it relates to.
This means that the script, with its default settings will create two Environment Variables called
If you were to change the
$UseEnvironmentVariables variable to
$false then the script will create the attributes as Environment Manager Session Variables. You can then access them using the
$() notation in the configuration as per the following screenshot.
Without further ado, the script is hosted as a gist on Github and is embedded here for completeness.