The script bellow allows you to locate users with invalid logon attempts
$strFilter = “(&(objectCategory=User)(badPwdCount>=0))”
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$colProplist = “name”
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults)
{$objItem = $objResult.Properties; $objItem.name}




You can eliminate the lines:
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher.SearchRoot = $objDomain
If you don’t specify a SearchRoot it defaults to the root of the default domain.