How to authenticate an user in ActiveDirectory with powershell
There are multiple ways of doing this. Here is a quick and simple function which authenticates a user to AD.
Function Test-ADAuthentication { param($username,$password) (new-object directoryservices.directoryentry "",$username,$password).psbase.name -ne $null}PS C:\> Test-ADAuthentication "dom\myusername" "mypassword"TruePS C:\>
It might not be the best function for your needs but your question lacks details.
Requires .NET 3.5 and PowerShell V2
$UserName = 'user1'$Password = 'P@ssw0rd'$Domain = $env:USERDOMAINAdd-Type -AssemblyName System.DirectoryServices.AccountManagement$ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext $ct,$Domain$pc.ValidateCredentials($UserName,$Password)