I want to validate a set of credentials against the domain controller. e.g.:
Username: STACKOVERFLOW\joel
Password: splotchyCan I do this via the command line?
12 Answers
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
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.