Solved

How do you Authenticate a User against The Active Directory

Posted on 2004-09-16
2
213 Views
Last Modified: 2010-04-13
I am writting a program using VBA and I want to know if there is a way to Authenticate a user against the Active Directory.  I would like the program to be able to have the user enter there username and password for the Domain and my program verify this data against the AD.
0
Comment
Question by:Alford-Miller
2 Comments
 
LVL 17

Expert Comment

by:Jared Luker
ID: 12078940
Sounds like you should ask this in the programming section...
0
 
LVL 16

Accepted Solution

by:
JamesDS earned 500 total points
ID: 12079374
Alford-Miller

This is VBscript Code, but it should do what you want:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Create connection to AD with authorised user account.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    strAuthUser            = "ADministrator"                                                ' Authorised user account name. Needs at least Domain Admin rights
    strAuthPassword        = "Pa55word"                                                ' Authorised user account password
    strAuthOUPath        = "ou=UsersAdmin"    ' Distinguished Name of OU containing Authorise User Account

sub AuthoriseOperation()

    ' Authenticate User
    Set oRoot    = GetObject("LDAP:")
    Set oOU        = oRoot.OpenDSObject("LDAP://dc=YOURDOMAIN, dc=COM", "cn="&strAuthUser&", "&strAuthOUPath, strAuthPassword, ADS_SECURE_AUTHENTICATION)
   
end sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

You can alter the code to accept input from the user for username and password

Cheers

JamesDS
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

821 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