列出AD用户Lockout 位置
有没有方法列出用户AD 用户在哪里lockout呢?可以参考如下微软网站上列出的Powershell 模板
- #Requires -Version 2.0
- Function Get-LockedOutLocation
- {
- <#
- .SYNOPSIS
- This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.
- .DESCRIPTION
- This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.
- The locked out location is found by querying the PDC Emulator for locked out events (4740).
- The function will display the BadPasswordTime attribute on all of the domain controllers to add in further troubleshooting.
- .EXAMPLE
- PS C:\>Get-LockedOutLocation -User Joe.Davis
- This example will find the locked out location for Joe Davis.
- .NOTE
- 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.
- The script is also dependent the ActiveDirectory PowerShell module, which requires the AD Web services to be running on at least one domain controller.
- Author:Jason Walker
- Last Modified: 12/7/2012
- #>
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True)]
- [String]$Identity
- )
- Begin
- {
- $DCCounter = 0
- $LockedOutStats = @()
- Try
- {
- Import-Module ActiveDirectory -ErrorAction Stop
- }
- Catch
- {
- Write-Warning $_
- Break
- }
- }#end begin
- Process
- {
- #Get all domain controllers in domain
- $DomainControllers = Get-ADDomainController -Filter *
- $PDCEmulator = ($DomainControllers | Where-Object {$_.OperationMasterRoles -contains "PDCEmulator"})
- Write-Verbose "Finding the domain controllers in the domain"
- Foreach($DC in $DomainControllers)
- {
- $DCCounter++
- Write-Progress -Activity "Contacting DCs for lockout info" -Status "Querying $($DC.Hostname)" -PercentComplete (($DCCounter/$DomainControllers.Count) * 100)
- Try
- {
- $UserInfo = Get-ADUser -Identity $Identity -Server $DC.Hostname -Properties AccountLockoutTime,LastBadPasswordAttempt,BadPwdCount,LockedOut -ErrorAction Stop
- }
- Catch
- {
- Write-Warning $_
- Continue
- }
- If($UserInfo.LastBadPasswordAttempt)
- {
- $LockedOutStats += New-Object -TypeName PSObject -Property @{
- Name = $UserInfo.SamAccountName
- SID = $UserInfo.SID.Value
- LockedOut = $UserInfo.LockedOut
- BadPwdCount = $UserInfo.BadPwdCount
- BadPasswordTime = $UserInfo.BadPasswordTime
- DomainController = $DC.Hostname
- AccountLockoutTime = $UserInfo.AccountLockoutTime
- LastBadPasswordAttempt = ($UserInfo.LastBadPasswordAttempt).ToLocalTime()
- }
- }#end if
- }#end foreach DCs
- $LockedOutStats | Format-Table -Property Name,LockedOut,DomainController,BadPwdCount,AccountLockoutTime,LastBadPasswordAttempt -AutoSize
- #Get User Info
- Try
- {
- Write-Verbose "Querying event log on $($PDCEmulator.HostName)"
- $LockedOutEvents = Get-WinEvent -ComputerName $PDCEmulator.HostName -FilterHashtable @{LogName='Security';Id=4740} -ErrorAction Stop | Sort-Object -Property TimeCreated -Descending
- }
- Catch
- {
- Write-Warning $_
- Continue
- }#end catch
- Foreach($Event in $LockedOutEvents)
- {
- If($Event | Where {$_.Properties[2].value -match $UserInfo.SID.Value})
- {
- $Event | Select-Object -Property @(
- @{Label = 'User'; Expression = {$_.Properties[0].Value}}
- @{Label = 'DomainController'; Expression = {$_.MachineName}}
- @{Label = 'EventId'; Expression = {$_.Id}}
- @{Label = 'LockedOutTimeStamp'; Expression = {$_.TimeCreated}}
- @{Label = 'Message'; Expression = {$_.Message -split "`r" | Select -First 1}}
- @{Label = 'LockedOutLocation'; Expression = {$_.Properties[1].Value}}
- )
- }#end ifevent
- }#end foreach lockedout event
- }#end process
- }#end function
- 本文转自 VirtualTom 51CTO博客,原文链接:http://blog.51cto.com/virtualtom/1130179,如需转载请自行联系原作者
列出AD用户Lockout 位置相关推荐
- 为AD用户启用或禁用OCS 2007 R2帐户
在搞完这一系列的部署,下面我们就可以为AD中的用户启用OCS帐户了,这也是我们这一系列部署的成果展现时刻.这个时候我们还无法直接在DC的AD用户和计算机中为用户启用OCS帐户,因为我们还没有安装独立的 ...
- ad用户和计算机报错,AD常用排错工具
3.netdom 对客户机加入域及信任关系管理 Example: netdom query dc netdom query fsmo 5%-10%的错误是由于对网络结构的错误认识. 4.netdiag ...
- 批量移动AD用户到指定OU
作为域管理员,在日常工作中使用ADUC(AD用户和计算机)工具在图形界面中进行账号管理操作可谓是家常便饭了.然而一个个增加.移动.删除用户,这样操作有时真的够烦,当管理大批量的账户时,重复操作浪费的时 ...
- 小程序获取用户当前位置计算距离最近的地铁站并获取对应地区的商品(可手动切换地铁线路及地铁站)
功能介绍 主要就是获取到用户当前位置的经纬度,调用后端api接口计算出距离最近的地铁站,并展示对应商家.用户可手动切换或者搜索地铁站点进行切换,切换后展示对应地铁站附近的商家 这里手动切换地铁站是直接 ...
- 在Windows客户端自动设置AD用户头像
Windows现在可以设置用户头像,并在开始菜单显示.如果你安装了Exchange或者Lync,那么可以在Outlook或者Skype里看到用户的头像.这个图片是存储在AD用户属性里的.对于桌面电脑的 ...
- H5使用百度地图SDK获取用户当前位置并且标记显示在地图
代码实现功能: H5使用百度地图SDK获取用户当前位置并且标记显示在地图,点击该标记弹出一层自定义的HTML. 效果图: 代码: <!DOCTYPE html> <html>& ...
- 根据经纬度获取用户当前位置信息
根据上篇文章获取的经纬度获取用户当前的位置信息 //获取用户所在位置信息ADDRESS func getUserAddress() { let latitude : CLLocationDegrees ...
- ad用户和计算机的使用方法,AD技巧之指定用户登录和指定计算机登陆
在域环境中我们往往默认情况下,域用户是可以在非域控机器上进行本地登录的,这里就涉及一个域安全问题 今天有人问我能否限制 某个用户只能登陆某台计算机?某台计算机只能由某个用户登录? 某个用户只能登陆某台 ...
- 转:SharePoint站点中用户信息与AD用户信息的“不一致”问题
先把问题描述一下:已把AD用户"User1"加到SharePoint站点中,然后进行如下类似操作:将"User1"从SharePoint站点中删除,将" ...
最新文章
- http路径转file会变成反斜杠_PHP session反序列化漏洞
- sql注入——day01
- JavaSE(十四)——网络编程(IP地址、端口号、TCP、UDP)
- 爬取京东商品分类和链接
- java+character类使用_Java Character类应用实例
- hbase hmaster启动起来就自动关闭
- 日期和时间的正则表达式
- android 设备标识
- Kotlin基础学习第5章—表达式
- NYOJ题目1057-寻找最大数(三)
- OTA时代来了!由新一代私有云揭开序幕
- 【脑电信号】基于matlab小波变换DWT脑电信号ECG去噪【含Matlab源码 1622期】
- SQLPlus登录及使用
- 通过anaconda下载 opencv的方法
- OpenCV概述及安装配置教程
- 谷歌浏览器上传下载奔溃问题解决方法
- 包装严重的IT行业,作为面试官,我是如何甄别应聘者的包装程度
- 原生前端实现响应式个人简历网站设计(附源码)
- ROUGE 简易安装教程
- dev c++播放音乐MP3
热门文章
- WINDOWS下调用GetTokenInformation的奇怪之处--两次调用
- LeetCode - 25. Reverse Nodes in k-Group
- linux kernel内存映射实例分析
- HP-UX B.11.31从安装到VG配置
- ASP.NET设置ie打印两法[转载]
- 2018-2019-1 20165325 20165320 20165337 实验二 固件程序设计
- div+css内容需注意
- 转大神的中国剩余定理
- IT职场常见疾病之“颈椎病”
- windows服务器下部署多台tomcat