【问题标题】:Detect switch user with powershell使用 powershell 检测切换用户
【发布时间】:2011-03-03 21:20:34
【问题描述】:

我想注册每次在机器中调用切换用户的日期和时间。我怎样才能做到这一点?与此类似,但针对“切换用户”事件:detect log off and on with powershell

提前谢谢你

【问题讨论】:

    标签: powershell switch-user


    【解决方案1】:

    我认为你正在寻找这个:

    Event ID 4778 : A user has logged by selecting Switch user command (Fast User Switching).
    Event ID 4779 : A user has logged back on using Switch user command (Fast User Switching).
    

    但只有当您在审计策略中配置“审计连接事件”时,这些事件才会出现在“安全”事件日志中。

    对不起,法国屏幕,但我认为这总比没有好。

    之后,当使用“快速用户切换”时,如果您过滤事件 ID 4778 和 4779,您会看到如下内容:

    因此,您在问题中指出的代码的 powerShell 改编类似于:

    clear-Host
    $UserProperty = @{n="User";e={$_.ReplacementStrings[0]}}
    $TypeProperty = @{n="Action";e={switch($_.EventID) {4778 {"SwitchOn"} 4779{"SwitchOff"}}}}
    $TimeProeprty = @{n="Time";e={$_.TimeGenerated}}
    Get-EventLog -LogName Security -Source Microsoft-Windows-security-auditing | where {$_.EventID -eq 4778 -or $_.EventID -eq 4779} | select $UserProperty,$TypeProperty,$TimeProeprty
    

    我希望这会有所帮助。

    日本

    PS:you can find other informations about "Fast user switching" in french there.

    【讨论】:

      猜你喜欢
      • 2015-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-26
      • 2011-06-10
      • 2012-05-22
      • 2012-05-02
      • 1970-01-01
      相关资源
      最近更新 更多