mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
433 B
PowerShell
18 lines
433 B
PowerShell
10 years ago
|
trap
|
||
|
{
|
||
|
Write-Error -ErrorRecord $_
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
$username = $args[0]
|
||
|
[void][system.reflection.assembly]::LoadWithPartialName('System.DirectoryServices.AccountManagement')
|
||
|
$pc = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext 'Machine', $env:COMPUTERNAME
|
||
|
For ($i = 1; $i -le 10; $i++) {
|
||
|
try {
|
||
|
$pc.ValidateCredentials($username, 'b@DP@ssw0rd')
|
||
|
}
|
||
|
catch {
|
||
|
break
|
||
|
}
|
||
|
}
|