Windows 10 - 取得日期範圍內每天的首次登入和最後一次登出

Windows 10 - 取得日期範圍內每天的首次登入和最後一次登出

我正在尋找是否有一種方法可以解析eventvwr特定 PC 上某個範圍內每個日期的首次登入和最後一次登出。我不需要獲得任何特定用戶...只需第一個和最後一個事件。

是否可以獲得每個不同日期的第一個和最後一個Winlogon事件?Windows Logs > System

任何資訊或方向將不勝感激。

答案1

你嘗試了什麼?您查看了哪些資源?向我們展示您的程式碼?描述什麼不起作用/糾正錯誤。您是否查看過 PowerShell 內建 cmdlet 中提供的用於處理事件日誌的範例。

Get-Command -Name '*winEvent*'

CommandType     Name                                               Version    Source                                                                                 
-----------     ----                                               -------    ------                                                                                 
Cmdlet          Get-WinEvent                                       3.0.0.0    Microsoft.PowerShell.Diagnostics                                                       
Cmdlet          New-WinEvent                                       3.0.0.0    Microsoft.PowerShell.Diagnostics  


Get-Command -Name '*event*log*'

-----------     ----                                               -------    ------                                                                                 
Cmdlet          Clear-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          Get-EventLog                                       3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          Limit-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          New-EventLog                                       3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          New-PefEventLogTrigger                             1.1.0.0    PEF                                                                                    
Cmdlet          Remove-EventLog                                    3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          Show-EventLog                                      3.1.0.0    Microsoft.PowerShell.Management                                                        
Cmdlet          Write-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management     


# Get parameters, examples, full and Online help for a cmdlet or function

(Get-Command -Name Get-EventLog).Parameters
Get-help -Name Get-EventLog -Examples
Get-help -Name Get-EventLog -Full
Get-help -Name Get-EventLog -Online

https://blogs.technet.microsoft.com/heyscriptingguy/2011/01/24/use-powershell-cmdlet-to-filter-event-log-for-easy-parsing

相關內容