5
A
回答
7
您可以从事件日志得到这个infromation:
Get-EventLog System -Source Microsoft-Windows-Winlogon
登录有7001的实例ID,注销有7002用户帐户是在ReplacementStrings一个SID。
这里有一些更有用的代码给你。
$UserProperty = @{n="User";e={(New-Object System.Security.Principal.SecurityIdentifier $_.ReplacementStrings[1]).Translate([System.Security.Principal.NTAccount])}}
$TypeProperty = @{n="Action";e={if($_.EventID -eq 7001) {"Logon"} else {"Logoff"}}}
$TimeProeprty = @{n="Time";e={$_.TimeGenerated}}
Get-EventLog System -Source Microsoft-Windows-Winlogon | select $UserProperty,$TypeProperty,$TimeProeprty
你也可以通过添加“-ComputerName”参数来获取,事件日志得到一个远程计算机的这些事件。
+0
就是这样!谢谢贾森。 – 2011-03-03 20:44:19
+0
你能帮我这个:http://stackoverflow.com/questions/5186693/detect-switch-user-with-powershell有什么可以帮助理解更好的get-eventlog吗?谢谢 – 2011-03-03 21:21:27
1
这样的事情已经在Windows系统日志,类型从“Winlogon”。不知道如何通过powershell从那里提取信息,但至少日志记录部分已经在那里了。
相关问题
- 1. GitHub如何检测登录/注销?
- 2. SQL Server检查Contraint并检查登录/注销状态
- 3. 检测注销
- 4. Silverstripe登录/注销
- 5. facebook登录/注销
- 6. Django登录/注销
- 7. 单元测试用户登录/注销
- 8. 登录并注销AD与C#
- 9. AngularJS注销并重新登录
- 10. 如何检测到您使用Google登录API注销?
- 11. 检测用户登录/注销xmpp谷歌应用引擎
- 12. 在c#中检测EventClass审核登录/注销
- 13. 春季安全登录/注销登录
- 14. Facebook登录注销实施
- 15. Wordpress登录注销菜单
- 16. 多个ssh登录/注销
- 17. 登录注销控件
- 18. 登录和注销jsf
- 19. 登录/注销动态
- 20. 登录和注销挥杆
- 21. 在EntLib中登录/注销
- 22. 登录+注销无aspnet_ *表?
- 23. 使用AJAX登录/注销
- 24. Dart登录/注销示例
- 25. 使用UITabBarController登录/注销?
- 26. CVS登录和注销
- 27. 在asp.net登录注销
- 28. 使用PowerShell提取登录/注销事件
- 29. 当登录时登录隐藏,登录时隐藏注销
- 30. 检索在线用户通过登录和注销记录
任何具有完整源代码的最终解决方案? – Kiquenet 2013-04-09 12:27:55