Communicator 2005 - need to define variables for user name
I am scripting MS Office Communicator 2005 and would like to autopopulate the user's email address before they start the program.
I would like to know how to obtain the user's full name (in the john.smith format) as a Variable so that I can enter the value as a %VAR% into the registry automatically. I have already created a script to do this I just need to know how to get the user name (or net user /fullname)(from the login credentials) in the correct form.
I have created the MST to autopopulate the LCS server name and am stuck on how to get the user's name into the correct fomat.
Even the first name as %FIRST% and the last name as %LAST% would achieve the goal - since I have also created a batch file to populate the registry based on a variable.
If my company used the employees UserName (%username%) then this would already be done.
Anybody care to assist? Thanks in advance for any and all help that you can provide.
Lks Dcvn
I would like to know how to obtain the user's full name (in the john.smith format) as a Variable so that I can enter the value as a %VAR% into the registry automatically. I have already created a script to do this I just need to know how to get the user name (or net user /fullname)(from the login credentials) in the correct form.
I have created the MST to autopopulate the LCS server name and am stuck on how to get the user's name into the correct fomat.
Even the first name as %FIRST% and the last name as %LAST% would achieve the goal - since I have also created a batch file to populate the registry based on a variable.
If my company used the employees UserName (%username%) then this would already be done.
Anybody care to assist? Thanks in advance for any and all help that you can provide.
Lks Dcvn
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
AB
17 years ago
The following vb script gets the SIP address from the AD (Live Communicator server has been set up) and writes it to the user profile - it may help...
Here the SIP address is not the same as a user's email address and isn't predictable so we need to query the AD at logon.
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
address = objUser.Get("msRTCSIP-PrimaryUserAddress")
address = Replace(address,"sip:","")
'msgbox address
objShell.RegWrite "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging" , address
Regards,
Al
Here the SIP address is not the same as a user's email address and isn't predictable so we need to query the AD at logon.
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
address = objUser.Get("msRTCSIP-PrimaryUserAddress")
address = Replace(address,"sip:","")
'msgbox address
objShell.RegWrite "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging" , address
Regards,
Al
Posted by:
lks dcvn
17 years ago
Posted by:
elgwhoppo
17 years ago
Posted by:
elgwhoppo
16 years ago
Here is my modified script to add the current logged on user information with commented out debugs & options. It assumes you are on a domain, so if you're in a workgroup, just use the simple one above, or modify it as needed. You can either set this script to run at every logon for every user (Place file path in registry string, at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", or do an ActiveSetup so it only runs once for each user that logs on the PC.
On Error Resume Next
Dim existingsipentry, keylocation, USER, DOMAIN, FULLUSERNAME, net, fso, logonstring
Set objShell = CreateObject("WScript.Shell")
Set objSysInfo = CreateObject("ADSystemInfo")
Set WSHShell = CreateObject("WScript.Shell")
Set Net = CreateObject("WScript.Network")
Set fso=CreateObject("Scripting.FileSystemObject")
Set EnvVar = WshShell.Environment("SYSTEM")
'Input Existing String
keylocation = "HKCU\Software\Microsoft\Communicator\"
existingsipentry = WSHShell.RegRead(keylocation & "UserMicrosoft RTC Instant Messaging")
'WScript.echo "existingsipentry " & existingsipentry
'Get email address from DRA
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
address = objUser.Get("msRTCSIP-PrimaryUserAddress")
address = Replace(address,"sip:","")
'WScript.echo "Address pulled from DRA: " & address
USER = WshShell.ExpandEnvironmentStrings("%USERNAME%")
DOMAIN = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
FULLUSERNAME = DOMAIN+"\"+USER
logonstring=address+" "+FULLUSERNAME
'WScript.echo "Current Address to compare: " & left(logonstring,9)
If left(logonstring,9)=" "+DOMAIN+"\" Then
'WshShell.Popup"Microsoft Communicator was unable to automatically obtain your login information. ",20,"Microsoft Office Communicator: Auto Login Information"
WshShell.RegDelete "HKCU\Software\Microsoft\Active Setup\Installed Components\{0EEB34F6-991D-4a1b-8EEB-772DA0EADB22}\"
ELSE
'Troubleshooting: what is being written to Address
'WScript.echo "Writing this to address " & address
objShell.RegWrite "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging" , logonstring
END IF
On Error Resume Next
Dim existingsipentry, keylocation, USER, DOMAIN, FULLUSERNAME, net, fso, logonstring
Set objShell = CreateObject("WScript.Shell")
Set objSysInfo = CreateObject("ADSystemInfo")
Set WSHShell = CreateObject("WScript.Shell")
Set Net = CreateObject("WScript.Network")
Set fso=CreateObject("Scripting.FileSystemObject")
Set EnvVar = WshShell.Environment("SYSTEM")
'Input Existing String
keylocation = "HKCU\Software\Microsoft\Communicator\"
existingsipentry = WSHShell.RegRead(keylocation & "UserMicrosoft RTC Instant Messaging")
'WScript.echo "existingsipentry " & existingsipentry
'Get email address from DRA
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
address = objUser.Get("msRTCSIP-PrimaryUserAddress")
address = Replace(address,"sip:","")
'WScript.echo "Address pulled from DRA: " & address
USER = WshShell.ExpandEnvironmentStrings("%USERNAME%")
DOMAIN = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
FULLUSERNAME = DOMAIN+"\"+USER
logonstring=address+" "+FULLUSERNAME
'WScript.echo "Current Address to compare: " & left(logonstring,9)
If left(logonstring,9)=" "+DOMAIN+"\" Then
'WshShell.Popup"Microsoft Communicator was unable to automatically obtain your login information. ",20,"Microsoft Office Communicator: Auto Login Information"
WshShell.RegDelete "HKCU\Software\Microsoft\Active Setup\Installed Components\{0EEB34F6-991D-4a1b-8EEB-772DA0EADB22}\"
ELSE
'Troubleshooting: what is being written to Address
'WScript.echo "Writing this to address " & address
objShell.RegWrite "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging" , logonstring
END IF
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.