| [[-InstanceId] <Int64[]>] |设定取得指定实例ID的事件 |Get-EventLog System -InstanceId 10016 | | [-Index <Int32[]>] |设定取得指定索引的事件 |Get-EventLog System -Index 13820 | | [-EntryType <String[]>] |设定取得指定错误类型的事件|
Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-UserName <String[]>] [<CommonParam...
Get-EventLog system | Where-Object {$_.EventID -eq “1074” -or $_.EventID -eq “6008” -or $_.EventID -eq “1076”} | ft Machinename, TimeWritten, UserName, EventID, Message -AutoSize -Wrap >c:\Restart.txt
Get-EventLog Cmdlet 會使用 LogName 參數來指定系統記錄檔。 EntryType 參數會篩選事件,只顯示 Error 事件。 範例5:使用 InstanceId 和 Source 值從事件記錄檔取得事件 此範例會從特定 InstanceId 和 Source 的系統記錄檔取得事件。 PowerShell 複製 Get-EventLog -LogName System -InstanceId 10016 -Source DCO...
通过powershell操作eventlog relevant command list ~\Desktop> (Get-Command Write-EventLog).Parameters Key Value--- ---WarningAction System.Management.Automation.ParameterMetadata RawData System.Management.Automation.ParameterMetadata Verbose System.Management.Automation.ParameterMetadata Warning...
Get-WinEvent[[-LogName] <String[]>] [-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXPath <String>] [-Force] [-Oldest] [<CommonParameters>] PowerShell复制 Get-WinEvent[-ListLog] <String[]> [-ComputerName <String>] [-Credential <PSCredential>] [-...
Get-EventLog -LogName System -EntryType Error //检测到系统错误 【获取登录信息】 gwmi Win32_LoggedOnUser //成功登录的记录 gwmi Win32_LoggedOnUser | ft Antecedent //成功登录的用户 【开关机相关】 Stop-Computer //关机 Restart-Computer //重启 ...
“*error*” {$e++} “*info*” {$i++} “*warn*” {$w++} } Write-Output “ $AppLog Contain following: Errors $e Warning $w Information $i ” 执行结果如图5所示。 图5 执行结果 (2)输出到XML文件 将日志导出为XML文件需要使用Export-Clixml,这里使用Get-EventLog cmdlet指定要获取的事件日志...
{Error | Information | FailureAudit | SuccessAudit | Warning}] [-Index <System.Int32[]>] [-Message <System.String>] [-Newest <System.Int32>] [-Source <System.String[]>] [-UserName <System.String[]>] [<CommonParameters>] Get-EventLog [-AsString] [-ComputerName <System.String[]>]...
Get-ComputerInfo 若要从应用程序日志检索最新的五个错误条目,请运行以下命令: PowerShell Get-EventLog-LogNameApplication-Newest5-EntryTypeError 若要清除本地计算机上的应用程序日志,请运行以下命令: PowerShell Clear-EventLog-LogNameApplication 补充阅读:有关 Microsoft.PowerShell.Management...