有没有方法列出用户AD 用户在哪里lockout呢?可以参考如下微软网站上列出的Powershell 模板

 

 
  
  1. #Requires -Version 2.0  
  2. Function Get-LockedOutLocation  
  3. {  
  4. <#  
  5. .SYNOPSIS  
  6.     This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.  
  7.  
  8. .DESCRIPTION  
  9.     This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.   
  10.     The locked out location is found by querying the PDC Emulator for locked out events (4740).    
  11.     The function will display the BadPasswordTime attribute on all of the domain controllers to add in further troubleshooting.  
  12.  
  13. .EXAMPLE  
  14.     PS C:\>Get-LockedOutLocation -User Joe.Davis  
  15.  
  16.  
  17.     This example will find the locked out location for Joe Davis.  
  18. .NOTE  
  19.     This function is only compatible with an environment where the domain controller with the PDCe role to be running Windows Server 2008 SP2 and up.    
  20.     The script is also dependent the ActiveDirectory PowerShell module, which requires the AD Web services to be running on at least one domain controller.  
  21.     Author:Jason Walker  
  22.     Last Modified: 12/7/2012  
  23. #>  
  24.     [CmdletBinding()]  
  25.  
  26.     Param(  
  27.       [Parameter(Mandatory=$True)]  
  28.       [String]$Identity        
  29.     )  
  30.  
  31.     Begin 
  32.     {   
  33.         $DCCounter = 0   
  34.         $LockedOutStats = @()     
  35.                   
  36.         Try  
  37.         {  
  38.             Import-Module ActiveDirectory -ErrorAction Stop  
  39.         }  
  40.         Catch  
  41.         {  
  42.            Write-Warning $_  
  43.            Break  
  44.         }  
  45.     }#end begin 
  46.     Process  
  47.     {  
  48.           
  49.         #Get all domain controllers in domain  
  50.         $DomainControllers = Get-ADDomainController -Filter *  
  51.         $PDCEmulator = ($DomainControllers | Where-Object {$_.OperationMasterRoles -contains "PDCEmulator"})  
  52.           
  53.         Write-Verbose "Finding the domain controllers in the domain" 
  54.         Foreach($DC in $DomainControllers)  
  55.         {  
  56.             $DCCounter++  
  57.             Write-Progress -Activity "Contacting DCs for lockout info" -Status "Querying $($DC.Hostname)" -PercentComplete (($DCCounter/$DomainControllers.Count) * 100)  
  58.             Try  
  59.             {  
  60.                 $UserInfo = Get-ADUser -Identity $Identity  -Server $DC.Hostname -Properties AccountLockoutTime,LastBadPasswordAttempt,BadPwdCount,LockedOut -ErrorAction Stop  
  61.             }  
  62.             Catch  
  63.             {  
  64.                 Write-Warning $_  
  65.                 Continue 
  66.             }  
  67.             If($UserInfo.LastBadPasswordAttempt)  
  68.             {      
  69.                 $LockedOutStats += New-Object -TypeName PSObject -Property @{  
  70.                         Name                   = $UserInfo.SamAccountName  
  71.                         SID                    = $UserInfo.SID.Value  
  72.                         LockedOut              = $UserInfo.LockedOut  
  73.                         BadPwdCount            = $UserInfo.BadPwdCount  
  74.                         BadPasswordTime        = $UserInfo.BadPasswordTime              
  75.                         DomainController       = $DC.Hostname  
  76.                         AccountLockoutTime     = $UserInfo.AccountLockoutTime  
  77.                         LastBadPasswordAttempt = ($UserInfo.LastBadPasswordAttempt).ToLocalTime()  
  78.                     }            
  79.             }#end if  
  80.         }#end foreach DCs  
  81.         $LockedOutStats | Format-Table -Property Name,LockedOut,DomainController,BadPwdCount,AccountLockoutTime,LastBadPasswordAttempt -AutoSize  
  82.  
  83.         #Get User Info  
  84.         Try  
  85.         {    
  86.            Write-Verbose "Querying event log on $($PDCEmulator.HostName)" 
  87.            $LockedOutEvents = Get-WinEvent -ComputerName $PDCEmulator.HostName -FilterHashtable @{LogName='Security';Id=4740} -ErrorAction Stop | Sort-Object -Property TimeCreated -Descending  
  88.         }  
  89.         Catch   
  90.         {            
  91.            Write-Warning $_  
  92.            Continue 
  93.         }#end catch       
  94.                                    
  95.         Foreach($Event in $LockedOutEvents)  
  96.         {              
  97.            If($Event | Where {$_.Properties[2].value -match $UserInfo.SID.Value})  
  98.            {   
  99.                 
  100.               $Event | Select-Object -Property @(  
  101.                 @{Label = 'User';               Expression = {$_.Properties[0].Value}}  
  102.                 @{Label = 'DomainController';   Expression = {$_.MachineName}}  
  103.                 @{Label = 'EventId';            Expression = {$_.Id}}  
  104.                 @{Label = 'LockedOutTimeStamp'; Expression = {$_.TimeCreated}}  
  105.                 @{Label = 'Message';            Expression = {$_.Message -split "`r" | Select -First 1}}  
  106.                 @{Label = 'LockedOutLocation';  Expression = {$_.Properties[1].Value}}  
  107.               )  
  108.                                                   
  109.             }#end ifevent  
  110.               
  111.        }#end foreach lockedout event  
  112.          
  113.     }#end process  
  114.      
  115. }#end function 


参考链接
http://gallery.technet.microsoft.com/scriptcenter/Get-LockedOutLocation-b2fd0cab