请参阅通过PowerShell 使用 FilterHashTable 筛选事件日志,以查看 2014 年 6 月 3 日的原创“脚本专家”博客文章。 本文摘录自此原创博客文章,并说明了如何使用 Get-WinEvent cmdlet 的 FilterHashtable 参数筛选事件日志。 PowerShell 的 Get-WinEvent cmdlet 是一种功能强大的方法,可用...
Get-WinEvent-FilterHashtable @{LogName='Application';Level=2} 这个命令将获取"Application"日志中所有等级为2的事件。 进一步过滤事件 虽然Get-WinEvent命令本身提供了一些过滤选项,但有时我们可能需要进行更复杂的过滤。在这种情况下,我们可以使用管道操作符 "|" 结合 Where-Object 命令进行进一步的过滤。例如,以...
可以是系统提供的日志名称,也可以是自定义的日志名称。 FilterHashtable:指定要应用的过滤条件。可以根据事件ID、事件级别、提供程序名称等进行过滤。 ComputerName:指定要检索事件日志的计算机名称。可以是本地计算机或远程计算机。 Credential:指定用于连接到远程计算机的凭据。 ListLog:列出可用的事件日志。 Force:强...
Logname = 'Citrix-VDA-CQI/Admin' Level = 1,2,3 StartTime = [datetime]::Today.AddDays(-1) } Get-WinEvent -FilterHashtable $Filter } | Select-Object MachineName,TimeCreated,Level,ID,Message | Out-GridView -Title "Results" 我在另一个帖子上看到了这一点,但是我很难把我所拥有的和我所发...
Get-WinEvent Cmdlet 會取得記錄資訊。 FilterHashtable 參數可用來篩選輸出。 LogName 機碼會將值指定為 Application 記錄。 StartTime 索引鍵會使用儲存在 $Date 變數中的值。 識別碼 索引鍵會使用事件識別碼值,1003。範例18:使用 FilterHashtable 來取得應用程式錯誤此範例會使用 FilterHashtable 參數...
$Date = (Get-Date).AddDays(-2) Get-WinEvent -FilterHashtable @{ LogName='Application'; StartTime=$Date; Id='1003' } Get-Date cmdlet 使用 AddDays 方法获取当前日期前两天的日期。 日期对象存储在 $Date 变量中。 Get-WinEvent cmdlet 获取日志信息。 FilterHashtable 参数用于筛选输出。 LogName ...
Get-WinEvent -FilterHashTable @{'LogName' = 'Application'; 'StartTime' = Get-Date "November 26, 2023 14:00:00"; } ``` Encountering issues: ```powershell Get-WinEvent -FilterHashTable @{'LogName' = 'Application'; 'StartTime' = Get-Date "November 26, ...
FilterHashtable Provides access to the FilterHashtable parameter. FilterXml Provides access to the FilterXml parameter. FilterXPath Provides access to the FilterXPath parameter. Force Provides access to the Force parameter. InformationAction Determines how information records should be handled by the acti...
C:\PS>$starttime = (get-date).adddays(-7) C:\PS> $ie-error = Get-WinEvent -FilterHashtable @{logname="application"; providername="Application Error"; data="iexplore.exe"; starttime=$starttime} Descrição --- Este exemplo usa uma tabela de hash de filtro para localizar os erro...
{ }. And by the huge difference I mean a really huge one. Depending on the amount of Event ID's stored a that you query for... it may take minutes or even hours to get a single RecordID. Since -FilterHashTable doesn't allowRecordIDas parameter, norGet-WinEventdoesn't have the-...