Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can you convert active directory Firstname/Lastname/Department to Variables?
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?

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:

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.


Forum Jump:

Users browsing this thread: 1 Guest(s)