Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jheinrichs79/496603121c6cc66ecfdc93b2c85355cb to your computer and use it in GitHub Desktop.
Save jheinrichs79/496603121c6cc66ecfdc93b2c85355cb to your computer and use it in GitHub Desktop.
Powershell - Domain Lockout Troubleshooter
<#
.SYNOPSIS
Quickly get the lockouts of Domain accounts
.DESCRIPTION
This script will show you the number of lockout of "X" amount of day.
It helps to easily track down lockout account issue and
.NOTES
Version: 1.0
Author: Jared Heinrichs
Creation Date: 11/22/2018
Purpose/Change: Initial script development
.EXAMPLE
Using the command "Get-ADDomain, you can easily get the PDCEmulator info.
Once you have that you can then fill out the pre-defined items.
#>
Get-ADDomain
#Pre-defined items
#======================================================================================
$PDCEmulator = "PDCEmulator-Name.domain.local"
$Days = "7"
$filterHashtable = @{logname='security';id=4740;starttime=(get-date).AddDays(-$Days)}
$userName = @{label='username';expression={$_.properties[0].value}}
$computerName = @{label='computername';expression={$_.properties[1].value}}
#======================================================================================
Get-WinEvent -ComputerName $PDCEmulator -FilterHashtable $filterHashtable | select-object -Property timecreated,$userName,$computerName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment