Scense

Full Version: Can you convert active directory Firstname/Lastname/Department to Variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to use our active directory lastname, firstname, email adress, department to variables so we can use it in application with a... i presume: %Firstname%, %Lastname%, %Department% variable?

How can we establish this?
Hi,

There are ways of doing this with Scense internal variables backed by System Parameters, but probably the easiest way of doing this is by adding a Scripting Action to your logon script with the following content:

Code:
Sub Scense_Main()
    ' Prepare the environment accessor
    Set wshShell = CreateObject( "WScript.Shell" )
    Set wshUserEnv = wshShell.Environment("USER")
   
    ' Reference the current user
    Set objSysInfo = CreateObject("ADSystemInfo")   
    Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
   
    ' Set the environment variables
    wshUserEnv("FirstName") = objUser.givenName
    wshUserEnv("LastName") = objUser.lastName
    wshUserEnv("Department") = objUser.department
End Sub

After executing this scripting action you can use these variables the way you suggested.

Cheers