Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created January 8, 2019 12:12
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 shaneis/020223a2dea0d3e2471c092393a6f141 to your computer and use it in GitHub Desktop.
Save shaneis/020223a2dea0d3e2471c092393a6f141 to your computer and use it in GitHub Desktop.
while ((Get-Date) -lt (Get-Date '2019-01-08 17:00:00')) {
$JamesLockedAccount = Search-ADAccount -LockedOut | Where-Object Name -eq 'James ReportWriter'
if ($JamesLockedAccount) {
New-BurntToastNotification -Text 'James is locked out again.'
# Since this is a script, I'll manually clean up after myself.
Remove-Variable -Name JamesLockedAccount
}
Write-Host '.' -NoNewLine
Start-Sleep -Seconds 180
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment