Scripts/Test-SWADCredential.ps1

function Test-SWADCredential
{
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true)]
        [pscredential]$Credential
    )
$load_assembly = [reflection.assembly]::LoadWithPartialName("System.DirectoryServices.AccountManagement")
$PrincipalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext("Domain")
$Cred_Test = $PrincipalContext.ValidateCredentials($Credential.UserName, $Credential.GetNetworkCredential().Password,"Negotiate")
Return $Cred_Test
}