Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Password Learning Tool
Add-Type -AssemblyName PresentationFramework
$ExpectedPassword = (New-Object `
PSCredential `
"josh",(Read-Host "What's the password you're trying to learn?" -AsSecureString) `
).GetNetworkCredential().Password
$Interval = 3600 # 1 hour
for (;;) {
$GuessedPassword = (Get-Credential -Username josh -Message "OK quiz time - what's your new password?").GetNetworkCredential().Password
if ($GuessedPassword -eq $ExpectedPassword) {
[System.Windows.MessageBox]::Show('Hey good job!', 'Password Learning Tool', 'Ok', 'Information')
} else {
[System.Windows.MessageBox]::Show(('Not quite - your password is: {0}' -f $ExpectedPassword), 'Password Learning Tool', 'Ok', 'Error')
}
Start-Sleep -Seconds $Interval
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.