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

列出AD用户Lockout 位置相关推荐

  1. 为AD用户启用或禁用OCS 2007 R2帐户

    在搞完这一系列的部署,下面我们就可以为AD中的用户启用OCS帐户了,这也是我们这一系列部署的成果展现时刻.这个时候我们还无法直接在DC的AD用户和计算机中为用户启用OCS帐户,因为我们还没有安装独立的 ...

  2. ad用户和计算机报错,AD常用排错工具

    3.netdom 对客户机加入域及信任关系管理 Example: netdom query dc netdom query fsmo 5%-10%的错误是由于对网络结构的错误认识. 4.netdiag ...

  3. 批量移动AD用户到指定OU

    作为域管理员,在日常工作中使用ADUC(AD用户和计算机)工具在图形界面中进行账号管理操作可谓是家常便饭了.然而一个个增加.移动.删除用户,这样操作有时真的够烦,当管理大批量的账户时,重复操作浪费的时 ...

  4. 小程序获取用户当前位置计算距离最近的地铁站并获取对应地区的商品(可手动切换地铁线路及地铁站)

    功能介绍 主要就是获取到用户当前位置的经纬度,调用后端api接口计算出距离最近的地铁站,并展示对应商家.用户可手动切换或者搜索地铁站点进行切换,切换后展示对应地铁站附近的商家 这里手动切换地铁站是直接 ...

  5. 在Windows客户端自动设置AD用户头像

    Windows现在可以设置用户头像,并在开始菜单显示.如果你安装了Exchange或者Lync,那么可以在Outlook或者Skype里看到用户的头像.这个图片是存储在AD用户属性里的.对于桌面电脑的 ...

  6. H5使用百度地图SDK获取用户当前位置并且标记显示在地图

    代码实现功能: H5使用百度地图SDK获取用户当前位置并且标记显示在地图,点击该标记弹出一层自定义的HTML. 效果图: 代码: <!DOCTYPE html> <html>& ...

  7. 根据经纬度获取用户当前位置信息

    根据上篇文章获取的经纬度获取用户当前的位置信息 //获取用户所在位置信息ADDRESS func getUserAddress() { let latitude : CLLocationDegrees ...

  8. ad用户和计算机的使用方法,AD技巧之指定用户登录和指定计算机登陆

    在域环境中我们往往默认情况下,域用户是可以在非域控机器上进行本地登录的,这里就涉及一个域安全问题 今天有人问我能否限制 某个用户只能登陆某台计算机?某台计算机只能由某个用户登录? 某个用户只能登陆某台 ...

  9. 转:SharePoint站点中用户信息与AD用户信息的“不一致”问题

    先把问题描述一下:已把AD用户"User1"加到SharePoint站点中,然后进行如下类似操作:将"User1"从SharePoint站点中删除,将" ...

最新文章

  1. http路径转file会变成反斜杠_PHP session反序列化漏洞
  2. sql注入——day01
  3. JavaSE(十四)——网络编程(IP地址、端口号、TCP、UDP)
  4. 爬取京东商品分类和链接
  5. java+character类使用_Java Character类应用实例
  6. hbase hmaster启动起来就自动关闭
  7. 日期和时间的正则表达式
  8. android 设备标识
  9. Kotlin基础学习第5章—表达式
  10. NYOJ题目1057-寻找最大数(三)
  11. OTA时代来了!由新一代私有云揭开序幕
  12. 【脑电信号】基于matlab小波变换DWT脑电信号ECG去噪【含Matlab源码 1622期】
  13. SQLPlus登录及使用
  14. 通过anaconda下载 opencv的方法
  15. OpenCV概述及安装配置教程
  16. 谷歌浏览器上传下载奔溃问题解决方法
  17. 包装严重的IT行业,作为面试官,我是如何甄别应聘者的包装程度
  18. 原生前端实现响应式个人简历网站设计(附源码)
  19. ROUGE 简易安装教程
  20. dev c++播放音乐MP3

热门文章

  1. WINDOWS下调用GetTokenInformation的奇怪之处--两次调用
  2. LeetCode - 25. Reverse Nodes in k-Group
  3. linux kernel内存映射实例分析
  4. HP-UX B.11.31从安装到VG配置
  5. ASP.NET设置ie打印两法[转载]
  6. 2018-2019-1 20165325 20165320 20165337 实验二 固件程序设计
  7. div+css内容需注意
  8. 转大神的中国剩余定理
  9. IT职场常见疾病之“颈椎病”
  10. windows服务器下部署多台tomcat