Solved

Verify User in NT

Posted on 2000-04-13
7
209 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 116
Computer crashes, following error message in event manager 5 201
VBA Shell can't Find Word document 11 94
Error with a code discussed on this page 5 16
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 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…
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…

803 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