Solved

Verify User in NT

Posted on 2000-04-13
7
213 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
Technology Partners: 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

624 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