troubleshooting Question

Login Script to pull users IP Phone from AD and then create a registry key in HKCU with that value

Avatar of rookeydooks
rookeydooks asked on
* RegeditActive DirectoryVB Script
8 Comments2 Solutions224 ViewsLast Modified:
I need a login script to pull the IP Phone from Active Directory and add the value to:

HKEY_CURRENT_USER/SOFTWARE/XYZ/PhoneClient

I found the script below on another website but unfortunately it thread ends with the original post'er saying.. they did a little tweaking to what was suggested and got it working! But they never posted what they done.

The suggested login script is

Dim objSysInfo, objUser
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
set strtelno = objuser.telephonenumber ' Currently logged in User

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\shoreline teleworks\shoreware client\"
KeyPath = "SOFTWARE\shoreline teleworks\shoreware client"
strValueName = "AgentID"
strValue = strtelno ' <-- This sets the Telephone Number
objRegistry.CreateKey HKEY_CURRENT_USER, strKeyPath, strvaluename, strvalue


I'm guessing i need to add an LDAP path on line 3 >> Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

Something like >> LDAP://OU=OurUSerGroup,DC=OurDomain,DC=com

I've researched objuser for IP Phone and it says use >> objuser.ipPhone (instead of line 4 >> set strtelno = objuser.telephonenumber ' Currently logged in User)

Then edit lines 9 and 10 >>
strKeyPath = "SOFTWARE\shoreline teleworks\shoreware client\"
KeyPath = "SOFTWARE\shoreline teleworks\shoreware client"

To our value >> SOFTWARE/XYZ/PhoneClient

I want to run this as a login script via Group Policy to around 50 users.
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros