Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Query LDAP to get user Telephone

Reply
 
Old 06-10-2009   #1 (permalink)
Omar Rodríguez


 
 

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
Old 06-10-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Query LDAP to get user Telephone

Omar Rodríguez wrote:
Quote:

> 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
Old 06-10-2009   #3 (permalink)
Omar Rodríguez


 
 

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
Quote:

> Omar Rodríguez wrote:
>
Quote:

>> 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
Reply

Thread Tools


Similar Threads
Thread Forum
working LDAP query, well almost.. 800A000D VB Script
How can I query LDAP in WLM? Live Mail
Why isn't this LDAP query working on the other domain in the fores VB Script
Not all users are retrieved in an LDAP query via ASP VB Script
help with LDAP query PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46