Solved

Verify User in NT

Posted on 2000-04-13
7
207 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
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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