How to validate windows domain credentials via the command line?

0

I want to validate a set of credentials against the domain controller. e.g.:

Username: STACKOVERFLOW\joel
Password: splotchy

Can I do this via the command line?

jimmy_terra

Posted 2013-05-20T17:09:15.937

Reputation: 115

Question was closed 2013-05-23T14:12:06.190

Is the computer you are doing the testing on already a member of the domain? – Scott Chamberlain – 2013-05-20T17:30:11.903

Answers

0

There's a very handy PowerShell function here for testing credentials:

Function Test-ADCredentials {
     Param($username, $password, $domain)
     Add-Type -AssemblyName System.DirectoryServices.AccountManagement
     $ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain
     $pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext($ct, $domain)
     New-Object PSObject -Property @{
          UserName = $username;
          IsValid = $pc.ValidateCredentials($username, $password).ToString()
     }
}

Example use: Test-ADCrendentials -Username joel -Password splotchy -Domain stackoverflow.com

Tanner Faulkner

Posted 2013-05-20T17:09:15.937

Reputation: 11 948

0

I tend to just connect to a share on the server:

net use \server\share * /user:domain\username

You're then prompted for a password and if the correct one is entered you now have a connection to the server and a response that the command completed successfully.

Multiverse IT

Posted 2013-05-20T17:09:15.937

Reputation: 4 228