Solved

Verify User in NT

Posted on 2000-04-13
7
211 Views
Last Modified: 2011-09-20
I need to write a program (in VB) which allows me to verify that a user is indeed a user in the NT PDC.

The user merely needs to provide a user name and password and my program will verify it from the list of NT users in a particular domain.
0
Comment
Question by:idleworm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2710881
Public Declare Function NetLocalGroupGetMembers Lib "netapi32.dll" (ByVal psServer As Long, ByVal psLocalGroup As Long, ByVal lLevel As Long, pBuffer As Long, ByVal lMaxLength As Long, plEntriesRead As Long, plTotalEntries As Long, phResume As Long) As Long



info about this function:
http://msdn.microsoft.com/library/psdk/network/ntlmapi2_9zw3.htm


are you looking for something like this?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2710900
http://www.mvps.org/vb/code/NetUser.zip
good sample application that shows how to use the various calls to the netapi32.dll
you can decide which one would best suit your needs to implement your task since you have several options to choose from.
0
 
LVL 1

Author Comment

by:idleworm
ID: 2710935
Thanx AzraSound although not what I exactly wanted...

All I need is to do is to verify whether the user (coming in) is indeed a valid user in the domain (given a User Name and Password). Assuming a user need to log On to my Exchange Server
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:AzraSound
ID: 2710973
so you already have coded all the available users on the domain?  then just perform check on what the user enters.  check the users username and if it is found in your list use the netusergetinfo to check whether the password is valid.

0
 
LVL 1

Author Comment

by:idleworm
ID: 2710996
Will check it out & let u know...
0
 
LVL 1

Accepted Solution

by:
Gotcha007 earned 100 total points
ID: 2711364
Hello , go to this URL
http://www.netfokus.dk/vbadmincode/
and choose WindowsNt in the top Menu.
Then choose User/group.
There are that's you want (like account).

0
 
LVL 1

Expert Comment

by:ATM
ID: 2714433
Here is simple method to do that:
Create
form1,
text1 - domain
text2 - user
text3 - pass
button1

Private Declare Function LogonUser Lib "advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Const LOGON32_LOGON_BATCH = 4
Private Const LOGON32_PROVIDER_DEFAULT = 0

Private Sub Command1_Click()
Dim szDomain As String
Dim szUser As String
Dim szPassword As String
Dim lToken As Long
Dim lResult As Long

szDomain = Text1.Text & Chr(0)
szUser = Text2.Text & Chr(0)
szPassword = Text3.Text & Chr(0)
lToken = 0&

lResult = LogonUser(szUser, _
                           szDomain, _
                           szPassword, _
                           ByVal LOGON32_LOGON_BATCH, _
                           ByVal LOGON32_PROVIDER_DEFAULT, _
                           lToken)
If lResult = 0 Then
   MsgBox "Error: " & GetLastError() & Err.LastDllError
Else
  If lToken = 0 Then
   MsgBox "Not Valid user, password or domain"
  Else
   MsgBox "Valid User"
  End If
End If
End Sub

Hope this help.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hide vba in gp 7 115
Modifying Conditional Format from VBA code 3 69
Prevent user closing word document opened with VB6 6 84
VBA: Insert New column with specific format type 12 54
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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

756 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