Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

How do you Authenticate a User against The Active Directory

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
Alford-Miller
Asked:
Alford-Miller
1 Solution
 
Jared LukerCommented:
Sounds like you should ask this in the programming section...
0
 
JamesDSCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now