Solved

Login Name

Posted on 2002-04-29
2
164 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

15 Experts available now in Live!

Get 1:1 Help Now