Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get users full name from Active Directory for rollout of Office

Status
Not open for further replies.

detroit

MIS
Sep 13, 2002
160
CA
I need to find a way to get the users FULL NAME for an office 2003 rollout so that I can automatically configure Outlook. Can anyone tell me how I can do this?

Thanks

Detroit
 
This should get you moving in the right direction. I'm not sure what medium you want the data in, or what vehicle you want to use to get the data, so here ia a possible solution that can be implemented within Office.
Code:
Public Function ADsFullName() As String
'This function requires a reference to _
Active DS Type Library (activeds.tlb)
'Will work in any office application that will _
allow you to write and run a macro
Dim objIADsUser As ActiveDs.IADsUser
Dim strUserID As String, strComputerName As String
strComputerName = Environ$("COMPUTERNAME")
strUserID = Environ$("USERNAME")
Set objIADsUser = GetObject("WinNT://" & _
  strComputerName & "/" & strUserID & ",user")
ADsFullName = objIADsUser.FullName
Set objIADsUser = Nothing
End Function
If this is not the 'FULL NAME' you are looking for, take a look at the Object Browser for ActiveDs, there is all sorts of good stuff you can get about a user.
CMP
 
I just need to be able to get the full name (Display name) from AD so I can put it into a MST file so I can setup Outlook 2003 for our users.

Not too familar with scripts, unless someone can help me with that as well.

Detroit
 
Here is another interation, please bear in mind that I am not familar with MST files so I am blindly aswering your question. Here is a small vbs cript that will return the information you are looking for.

Open notepad (or you ASCII test editor of choice) and copy the following script into it:
Code:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objIADsUser = GetObject("WinNT://" & WshNetwork.UserDomain & "/" & WshNetwork.UserName & ",user")
WScript.Echo objIADsUser.FullName
Save the file with the extension .vbs, then click on the file you just saved and after a few moments you will get a popup with the ADs fullname.

This is written to be run on the local (user's) machine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top