I recently did a favor for a friend of mine who wanted tie a couple of systems together that weren’t tightly integrated in his network with some scripts. Anyway, I found the idea in his case fairly novel so I adapted the idea to the ShoreTel phone system and logon scripts. I know a lot of companies out there where the user’s four digit extension is their PIN for various systems at least initially.
I’ve had similar requests before to write a program that extracted the user’s extension from the ShoreTel database and do something with it. I do have a method of doing that but it’s annoying and this is much easier since it comes from the user’s local machine with ShoreTel Communicator installed. I’m also including some other registry keys because this script is super easy to adapt to get this information too.
Script for Extracting Current User’s Extension from ShoreTel Communicator
This is a VB Script for extracting the user’s extension from their computer’s registry. It is intended to be used as a part of a logon script or just to run at any time. The plugin I use doesn’t like VB comments so I took them out, I’ve attached the fully commented script to the post.
Use this script at your own risk. It just reads a registry key, but any time you mess with the registry, ShoreTel or anything like that you assume responsibility for your own systems. Also if your environment is different for whatever reason, this is not a hard script to change to suit your needs.
Script File: extractExtension (rename this to extractExtension.vbs when you download it)
Dim shoretelServer Dim objRegistry Dim extension shoretelServer = "shoretel" Set objSysInfo = CreateObject("ADSystemInfo") strUser = objSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser) Set objRegistry = CreateObject("Wscript.shell") extension = objRegistry.RegRead("HKEY_CURRENT_USER\Software\Shoreline Teleworks\CSIS Client\"& shoretelServer & "." & objUser.sAMAccountName & "\SUserID") Wscript.Echo extension
There are a few more registry keys that can be put to good use by enterprising script users that may want to automate a few things. Use this information entirely at your own risk. I’m not taking any responsibility for anything if you change these.
Also, some of these keys, just because you change them does not mean it actually does anything. Some of them are just flags to show the Communicator software that it has done something or not, such as uninstalled the Outlook Voicemail Plugin. Changing that key won’t uninstall the plugin if it’s messed up.
One potential use for this information is if your server crashes and you don’t have a backup. If Communicator is still installed everywhere you can recover all your user information with a simple script that goes through everyone’s machines to extract the information. If there is interest in such a thing I will write it and post it.
HKEY_CURRENT_USER\Software\Shoreline Teleworks\CSIS Client\servername.username\
This key has several values under it. The most useful are:
SUserID = Extension of User
FirstName = User’s First Name
LastName = User’s Last NameHasMailbox = Set to 1 if yes, 0 if no.
MailboxGUID = Haven’t seen this set on the versions I’ve worked with but maybe?
If you go up a level there are some values for the current server version and client version, some dynamic “ConnectedOnce” values if the client has connected to multiple servers.
There’s a lot here to look at. Some of this looks to be stuff it gets from the server. I fiddled with a few of these and they just reset when I loaded Communicator. Likely for features I don’t have access to.
HKEY_CURRENT_USER\Software\Shoreline Teleworks\ShoreWare Client
AutoStartSoftPhone = Starts the softphone automatically when you start the program. This is set to 0 when Extension Assignment is on primary phone, 1 when on Softphone.
Outlook Voice Mail = 1 if Outlook Voicemail Integration is Installed. 0 if no.
OwnedDNs = User Extension.
Server = Server the client is logged into. Might be a good key to read to get information for the above script.
UserName = User the Client was logged in with. Again, good information for above script.
VMFoldersExpanded = This shows some dynamic keys for various Voicemail boxes that the user has access to. Not sure what the numbers mean.
Under the above key is the Layouts key with a bunch of subkeys. These seem to be related to how the client looks and behaves. I won’t go through all these. I just wanted to mention that possibly deleting or modifying these might clear up weird issues that occasionally crop up with older versions of Communicator or find lost windows when users drag them off the screen, rather than reinstalling the whole product, or deleting the entire Shoreline key.
HKEY_CURRENT_USER\Software\Shoreline Teleworks\ShoreWare Client\Layouts