【发布时间】:2014-12-24 00:44:19
【问题描述】:
我有一个脚本,当它完成显示运行它的用户时,我需要将审计事件写入 Windows 安全日志。
我可以写入安全日志以外的任何日志。
我该怎么做?
New-EventLog -LogName Security -Source "MyApp"
Write-EventLog -LogName Security -source "MyApp" -EntryType Information -EventId 1 -Message "Script run by X"
当名称从 Security 更改为 Application 或 System 时,它可以工作 - 但是,我在使用 Security 时不断收到以下信息:
Write-EventLog : 源日志“Security”的注册表项 无法打开“msevent”。在行:1 字符:1 + Write-EventLog -LogName Security -source "msevent" -EntryType Information -Event ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Write-EventLog],异常 + FullyQualifiedErrorId : AccessDenied,Microsoft.PowerShell.Commands.WriteEventLogCommand
我是管理员,不知道为什么会发生这种情况,即使在尝试修改注册表安全权限之后也是如此。
有人知道我该怎么做吗?
【问题讨论】:
标签: windows security powershell logging