小编adr*_*ing的帖子

变量中具有多个 ID 的 Get-WinEvent -FilterHashTable 不起作用

这对我来说工作:

Get-WinEvent -FilterHashTable @{Logname = "ForwardedEvents" ; ID = 4625,4740}
Run Code Online (Sandbox Code Playgroud)

(……我期望的结果……)

这有效:

$EventId = "4625"

Get-WinEvent -FilterHashTable @{Logname = "ForwardedEvents" ; ID = $EventId}
Run Code Online (Sandbox Code Playgroud)

这不起作用:

$EventId = "4625,4740"

Get-WinEvent -FilterHashTable @{Logname = "ForwardedEvents" ; ID = $EventId}
Run Code Online (Sandbox Code Playgroud)

错误...

  Get-WinEvent : No events were found that match the specified selection criteria.
At line:1 char:13
+ Get-WinEvent <<<<  -FilterHashTable @{Logname = "ForwardedEvents" ; ID = $EventIds}
+ CategoryInfo          : ObjectNotFound: (:) [Get-WinEvent], Exception
+ FullyQualifiedErrorId : NoMatchingEventsFound,Microsoft.PowerShell.Commands.GetWinEventCommand
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

powershell event-log

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

event-log ×1

powershell ×1