Solved

Login Name

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
How to edit the macro code to limit the number of characters when creating worksheet tab name 5 49
How to make an ADE file by code? 11 87
TT Auto Dashboard 13 92
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

810 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