Windows Vista Forums

Query LDAP to get user Telephone

  1. #1


    Omar Rodríguez Guest

    Query LDAP to get user Telephone

    Hello,



    Could you please send me a sample script, about how get the user telephone
    field from active directory?

    We have Windows 2003 and the users are using XP.

    We need the user telefhone number from active directory in order to
    configure the softphone at user logon.
    Thank you in advance.



    --
    Greetings,
    Omar Rodríguez
    Telecomunications Analyst & Programmer
    VoiceTeam



      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: Query LDAP to get user Telephone

    Omar Rodríguez wrote:

    > Could you please send me a sample script, about how get the user telephone
    > field from active directory?
    >
    > We have Windows 2003 and the users are using XP.
    >
    > We need the user telefhone number from active directory in order to
    > configure the softphone at user logon.
    > Thank you in advance.
    >
    An example to retrieve the telephone number of the current user:
    =========
    Set objSysInfo = CreateObject("ADSystemInfo")
    Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
    strPhone = objUser.telephoneNumber
    Call MsgBox("Your telephone number in Active Directory is " & strPhone)
    ======
    To retrieve for another specified user, then change the number and save, the
    code could be similar to:
    ======
    ' Bind to user using Distinguished Name.
    Set objUser = GetObject("LDAP://cn=Jim Smith,ou=West,dc=MyDomain,dc=com")
    ' Retrieve telephone Number.
    strPhone = objUser.telephoneNumber
    ' Display.
    Call MsgBox("Old telephone number is " & strPhone)
    ' Assign a new number.
    objUser.telephoneNumber = "123-456-3451"
    ' Save changes.
    objUser.SetInfo
    ====
    Does this help?

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  3. #3


    Omar Rodríguez Guest

    Re: Query LDAP to get user Telephone


    Thank you a lot Richard.
    It works. This news group really works!

    --
    Greetings,
    Omar Rodríguez
    Telecomunications Analyst & Programmer
    VoiceTeam
    "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
    message news:Oo2pv5c6JHA.1416@xxxxxx

    > Omar Rodríguez wrote:
    >

    >> Could you please send me a sample script, about how get the user
    >> telephone field from active directory?
    >>
    >> We have Windows 2003 and the users are using XP.
    >>
    >> We need the user telefhone number from active directory in order to
    >> configure the softphone at user logon.
    >> Thank you in advance.
    >>
    >
    > An example to retrieve the telephone number of the current user:
    > =========
    > Set objSysInfo = CreateObject("ADSystemInfo")
    > Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
    > strPhone = objUser.telephoneNumber
    > Call MsgBox("Your telephone number in Active Directory is " & strPhone)
    > ======
    > To retrieve for another specified user, then change the number and save,
    > the code could be similar to:
    > ======
    > ' Bind to user using Distinguished Name.
    > Set objUser = GetObject("LDAP://cn=Jim Smith,ou=West,dc=MyDomain,dc=com")
    > ' Retrieve telephone Number.
    > strPhone = objUser.telephoneNumber
    > ' Display.
    > Call MsgBox("Old telephone number is " & strPhone)
    > ' Assign a new number.
    > objUser.telephoneNumber = "123-456-3451"
    > ' Save changes.
    > objUser.SetInfo
    > ====
    > Does this help?
    >
    > --
    > Richard Mueller
    > MVP Directory Services
    > Hilltop Lab - http://www.rlmueller.net
    > --
    >
    >


      My System SpecsSystem Spec

Query LDAP to get user Telephone

Similar Threads
Thread Thread Starter Forum Replies Last Post
LDAP query list of users Wedders VB Script 2 30 Sep 2009
working LDAP query, well almost.. 800A000D Sander VB Script 7 19 Jun 2009
How can I query LDAP in WLM? Michael Gao Live Mail 2 28 Apr 2009
Not all users are retrieved in an LDAP query via ASP Newcomsas VB Script 1 09 Oct 2008
help with LDAP query Ben Christian PowerShell 4 10 Mar 2008