为什么我在使用 Powershell get-winevent 时会收到未经授权的错误?

use*_*162 10 powershell user-accounts

我是域管理员,我尝试在提升的控制台中运行(右键单击> 以管理员身份运行),并且在执行时始终出现错误

get-winevent -logname application | where {$_.message -match "Faulting application"} | `
                                    select TimeCreated,message
Run Code Online (Sandbox Code Playgroud)

我会得到三行结果,然后

Get-WinEvent : Attempted to perform an unauthorized operation.
At line:1 char:13 Get-WinEvent : Attempted to perform an unauthorized operation.
 + CategoryInfo          : NotSpecified: (:) [Get-WinEvent], UnauthorizedAccessException
 + FullyQualifiedErrorId : Attempted to perform an unauthorized operation.,Microsoft.PowerShell.Commands.GetWinEventCommand
Run Code Online (Sandbox Code Playgroud)

这似乎是一个新的发展,以前没有遇到过这些错误。

它是一致的 - 如果我从另一台服务器使用 -computername 运行它,模式仍然是 3 OK 行,然后是 X 错误,然后是 5 OK 行,等等。

Gre*_*ray 1

其他事件日志也会发生这种情况吗?例如,如果您运行以下命令来查看具有特定事件 ID 的登录事件会怎样?:

Get-WinEvent -FilterHashtable @{logname='security'; id=@(4624,4634,4672,4648)}
Run Code Online (Sandbox Code Playgroud)

如果有效,则应用程序事件日志中可能存在您无权访问的某些项目。在这种情况下,您必须使用进程监视器之类的工具来找出您的访问被拒绝的原因。

使用 FilterHashtable 参数将筛选条件传递给 Get-WinEvent cmdlet 可能会获得更好的结果。有关示例,请参阅http://ss64.com/ps/get-winevent.html 。