小编ble*_*iri的帖子

使用 powershell 将事件写入事件日志

我有一个 powershell 脚本,我想将其添加到事件日志中。

当我输入 Write-Eventlog 命令时,我收到一条错误消息。

Write-EventLog -Logname autosnapshot -Source 'D:\script autoSnapshots.ps1' -EventId 8000 -Entrytype Information -Message 'Creates Snapshots and deletes snapshots older than 1 day'
Run Code Online (Sandbox Code Playgroud)

我虽然语法是正确的,但收到一条错误消息。

Write-EventLog: The term 'Write-EventLog' is not recognized as a name of a cmdlet, function, script file, or executable program.
Run Code Online (Sandbox Code Playgroud)

检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

有人知道我做错了什么吗?

任何帮助表示赞赏。

powershell event-log

7
推荐指数
1
解决办法
2922
查看次数

标签 统计

event-log ×1

powershell ×1