Solved

Login Name

Posted on 2002-04-29
2
163 Views
Last Modified: 2010-05-02
Hi All,
I was wondering what would be the best way to get the NT login names for users if I know there first name and last name. I was thinking about using ADSI. Is this a good solution.
Thank You,
Kent
0
Comment
Question by:kmurphy7
2 Comments
 

Accepted Solution

by:
iski2 earned 50 total points
ID: 6978268
Try using:

Dim uLst
Set uLst = GetObject("WinNT://DomainName")
uLst.Filter = Array("User")
For Each User In uLst
List1.AddItem User.fullname
Next
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6978279
Here is the code we use to get the user's login name

Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long


Public Function GetUserName() As String
Dim UserName As String * 255

Call GetUserNameA(UserName, 255)
GetUserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
End Function

mlmcc
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now